method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
5c7dc413-6839-48b8-838b-7603726f24ed
7
protected double objectiveFunction(double[] x){ double nll = 0; // -LogLikelihood int dim = m_NumPredictors+1; // Number of variables per class for(int i=0; i<cls.length; i++){ // ith instance double[] exp = new double[m_NumClasses-1]; int index; for(int offset=0; offset<m_NumClasses-1; offs...
1ce54d04-a67d-42b6-ba00-9ab821daf42a
9
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, java.io.IOException { try { HttpSession session = request.getSession(true); AlumnoBean alumno = ((AlumnoBean) (session.getAttribute("currentSessionUser"))); System.out.println("RUT SESION: "+alumno....
5a3faa1f-99fa-4644-b98b-6d6d6e8b962e
4
public void insertCommentDependencies(BasicDBList comments) { Map<String, List<DBObject>> map = new HashMap<String, List<DBObject>>(); BasicDBList photoIds = new BasicDBList(); for (Object objectComment : comments) { DBObject comment = (DBObject) objectComment; String ph...
04f5b9f8-73f6-4dd9-bb7b-ab8889b054f3
3
public void setLeft(PExp node) { if(this._left_ != null) { this._left_.parent(null); } if(node != null) { if(node.parent() != null) { node.parent().removeChild(node); } node.parent(this); } ...
6b84a838-091c-4c58-ac55-67f3cbed85df
8
public void setPos(ChessPosition pos) { if (state != GameState.PLAYING) { System.out.println("finish game: " + state); return; } if (isChooseForMove(pos)) { // chon quan de di chuyen // loai bo pos khong hop le if (board.getPiece(pos) == 0) return; oldPos = pos; // neu hop le thi danh dau oldP...
ff249b6c-2159-4b25-866e-375cccc8e7d3
3
public synchronized Promotion removePromotion(Promotion promotion) { if (promotion != null) { for (Promotion promotionAux : listPromotion) { if (promotionAux.getPromotionCode() == promotion .getPromotionCode()) { listPromotion.remove(promotionAux); logger.info("Promotion successfully Removed! P...
eb577c83-adf9-4332-b2b9-7c53c37ac7cc
0
private void initInput() { moveLeft = new GameAction("moveLeft"); moveRight = new GameAction("moveRight"); jump = new GameAction("jump", GameAction.DETECT_INITAL_PRESS_ONLY); exit = new GameAction("exit", GameAction.DETECT_INITAL_PRESS_ONLY); fire = new Ga...
2cac073f-ed9e-4c82-98f7-852cb6e0071b
6
public boolean compleixRes(Clausula c, ClausulaNom cn) { Aula aulaa = cn.getAula(); int horaa = cn.getHora(); String diaa = cn.getDia(); int dur = c.getDuracio(); boolean compleix = true; if (this.aula.equals(aulaa)) { //Si hablan de la aula que esta restringida ...
ae9edabc-9faf-4ac0-99b9-b3a2967df517
9
public void getSignature(SourceWriter writer) { writer.printIndent(); // process visibility if (this._visibility != null && this._visibility.length() > 0) { writer.print(this._visibility).print(" "); } if (this.getSuperClass() != Type.OBJECT_CLASS) { writer.print("type ").print(this.getName()...
74e57ddb-b6c0-44c3-a315-d677441efe6d
2
@Override public int compare(double[] b1, double[] b2) { if (b1[col] < b2[col]) { return -1 * order; } else if (b1[col] == b2[col]) { return 0 * order; } else { return 1 * order; } }
89384d67-13ce-4634-a97f-98159fb8dc77
7
public void reset() { history.clear(); for (Cell cell : all()) { if (cell.isEditable()) { cell.clear(); if (!initialPoss) { cell.poss().clear(); } } } if (initialPoss) { for (Cell cell...
a5facda1-00cb-4d3a-9ac9-0ada572c6036
9
public static void setFontForComponent(Component Comp, Font font) { if (font == null) { try { if (Locale.getDefault().toString().toLowerCase().contains("zh")) { font = new Font("Microsoft YaHei", Font.PLAIN, 12); } } catch (Throwable e)...
47f48677-5316-480a-a70a-e3e69851abe9
2
private boolean menuHasAddFriend(int arg0) { if (arg0 < 0) { return false; } int k = menuActionOpcode[arg0]; if (k >= 2000) { k -= 2000; } return k == 337; }
e6df7499-5d7e-46ca-8809-75c3c58fa925
4
@Override public void actionPerformed(ActionEvent e) { if (e.getSource() == load) try { loadFile(); } catch (FileNotFoundException ex) { System.out.println("File not found: " + ex.getMessage()); } catch (IOException ex) { System.out.printl...
08594f3c-ce6f-48bd-ad90-0eebe9d1f54b
0
public void setClientName(String clientName) { this.clientName = clientName; }
78f63428-f82b-4dd7-bfca-9d6400ce6687
7
@Override public Carte modifier_carte(HashMap<String, Object> map) { String nom = this.nom,actions = this.actions; int type = this.type_dresseur; if(map.get("nom") instanceof String && !map.get("nom").equals("")) nom = map.get("nom").toString(); if(map.get("actions") instanceof String && !map.get("actions")...
1817b1ab-2b4d-4e3d-8512-1ec85b7524db
9
private void RegenerateFurniCollisionMap() { for(int x = 0; x < this.GrabModel().MapSizeX; x++) //Loopception courtesy of Cobe & Cecer { for(int y = 0; y < this.GrabModel().MapSizeY; y++) { FurniCollisionMap[x][y] = 1; } } for(FloorItem Item : FloorItems.values()) { for(AffectedTile Tile :...
f6e7a54f-2ce3-4254-8461-8d667480f97d
1
public VariableStack mapStackToLocal(VariableStack stack) { if (!stack.isEmpty()) throw new IllegalArgumentException("stack is not empty at RET"); return null; }
0ec59e47-6e12-4d77-8ac1-04291b8a2758
6
@Override public void execute() throws BuildException { PageUnit.init(); try { if (theFile != null) { PageUnit.processFile(theFile); } else if (theDir != null) { PageUnit.processFile(theDir); } else if (theTest != null) { if (thePath == null) { PageUnit.processFile(new File(theTest)); ...
4f3b7e29-dcf7-47ec-af96-8ead74582799
2
@Override public boolean isEmailInDatabase(String email) { String sql = "SELECT * FROM customer WHERE email='" + email + "';"; Connection con = null; try { con = getConnection(); PreparedStatement statement = con.prepareStatement(sql); ResultSet resultSet = statement.executeQuery(); return resultS...
8b52916c-34fc-4961-8312-36313a6137b4
8
public static int countNeighbours(boolean[][] world, int col, int row) { int c = 0; if (getCell(world, col - 1, row - 1) == true) { c += 1; } if (getCell(world, col, row - 1) == true) { c += 1; } if (getCell(world, col + 1, row - 1) == true) { ...
a9c03e93-38e2-40b9-a512-7eb729787be6
8
public void setVariable(String var, Object val){ for(String p : localVars.keySet()){ if(p.equals(var)){ String type = localVars.get(p).getClass().getSimpleName(); if(!var.getClass().getSimpleName().equals(type)){ try{ if(type.toLowerCase().equals("float")) localVars.put(p, (float) val); ...
924129c5-6285-4d86-9d23-34ac69f304e2
3
public static Random getRandom() { // construct the singleton random object if it does not yet exist if(randomGenerator == null) { if(Configuration.useSameSeedAsInPreviousRun) { randomSeed = AppConfig.getAppConfig().seedFromLastRun; } else { if(Configuration.useFixedSeed){ randomSeed = Configurat...
3c937f34-a350-4cb7-8f02-1d09767d830b
2
public void done() { int remain = remainingTransitions.size(); if (remain != 0) { Transition t = (Transition) remainingTransitions.iterator().next(); drawer.addSelected(t.getFromState()); JOptionPane.showMessageDialog(view, remain + " transition" + (remain == 1 ? "" : "s") + " remain " + "to be placed...
d29d2556-eeb5-4d3d-b33e-e438e6df1fc5
4
@Override public void undo() { if(prevSpeed==CeiligFan.HIGH){ ceilingFan.high(); }else if(prevSpeed==CeiligFan.MEDIUM){ ceilingFan.medium(); } else if(prevSpeed==CeiligFan.LOW){ ceilingFan.low(); } else if(prevSpeed==CeiligFan.OFF){...
53cdfabc-fc05-41db-9fd4-7d6f5c8b2eb7
7
static public Class getWrapperClass (Class type) { if (type == int.class) return Integer.class; else if (type == float.class) return Float.class; else if (type == boolean.class) return Boolean.class; else if (type == long.class) return Long.class; else if (type == byte.class) return Byte.class;...
2aab71d9-8194-4752-acc0-0390a7d185ef
9
public static Orientation valueOf(boolean flipAroundHorizontal, Rotation rotation) { Orientation result = null; if (!flipAroundHorizontal) { switch (rotation) { case NOTHING: result = TOP_LEFT ; break; case LEFT : result = LEFT_BOTTOM ; break; case OVER : result = BOTTOM_RIGHT; b...
2fd6ebc9-8c91-42cb-8167-a3354ecd8f11
6
public AchaMazeWindow() throws AchaMazeException { setDefaultCloseOperation(EXIT_ON_CLOSE); setSize(640, 480); setTitle("AchaMaze"); MyPanel panel = new MyPanel(); add(panel); setVisible(true); say("Welcome."); maze = MazeExamples.ExampleMaze1(); drawMaze = new DrawMaze(maze); panel.repaint...
17201206-f2d7-4ebf-af3c-449bf2f24fd5
7
private boolean runChecks(){ // Check 1: Is it time to go home? if(office.getTime() >= dayEndTime){ // End the thread return false; } // Lunch time? if(office.getTime() >= lunchTime && !hadLunch){ try { long startCheck = System.currentTimeMillis(); System.out.println(office.getStringT...
8ed9e969-74c7-4cd8-a45c-aa584de1058f
6
@Override public Object getValueAt(int rowIndex, int columnIndex) { Change ch = changes.get(rowIndex); switch (columnIndex) { case 0: return changeSelected.get(rowIndex); case 1: return ch.getType(); case 2: return ch.getDescription(); case 3: return ch.getTarget(); case 4: re...
15b4a05b-9e71-427b-9b6c-b82d68cfdb6f
8
public void restore() { logger.debug("enter restore method"); configService.initRestoreConfig(); List<String> restoreIndices = configService.getRestoreIndices(); if(restoreIndices == null || restoreIndices.size()==0){ restoreIndices = findAllIndexesFromDir(); } if(restoreIndices!=null && restoreIndices.s...
127ac281-6446-48b3-a9f2-1378afd2b188
9
@Override public <T extends Comparable<? super T>> int search(T[] array, T key) { if (array == null) throw new NullPointerException("argument array is null"); if (key == null) throw new NullPointerException("argument key is null"); // Make sure every element is not n...
3971f7c3-a225-4ca7-b80f-0f8f7f949fde
7
public static synchronized Date stringToDate(String dateString) throws ParseException { if (dateString.length() == 4) { return YEAR_FORMAT.parse(dateString); } else if (dateString.length() == 6) { return MONTH_FORMAT.parse(dateString); } else if (dateString.length() == 8) { return DAY_FORM...
c48c1b9c-909d-467d-a265-a8493093a0ef
1
public static String getRequestChatName(String inString) throws JDOMException, IOException, TagFormatException { String result = ""; SAXBuilder mSAXBuilder = new SAXBuilder(); Document mDocument = mSAXBuilder.build(new StringReader(inString)); Element rootNode = mDocument.getRootElement(); String protTyp...
ddc011d3-c076-4c2c-b5f8-caab415f651b
3
public Task getTaskByIdName(String id, String name) throws FileNotFoundException, JAXBException{ //Check this line //FileInputStream stream = new FileInputStream("/WEB-INF/task-manager-xml.xml"); FileInputStream stream = new FileInputStream("C:/Users/Efrin Gonzalez/Documents/task-manager-xml.xml"); // create ...
6539d0b9-a0a0-4e1c-865d-9795e1b2ec6c
3
public boolean recordParamNames(CodeAttribute ca, int numOfLocalVars) throws CompileError { LocalVariableAttribute va = (LocalVariableAttribute) ca.getAttribute(LocalVariableAttribute.tag); if (va == null) return false; int n = va.tableLength();...
76e9115e-6038-496c-928e-c9220393ac3a
3
public int extraerUltimoRegistro(String nombretabla, String[] campos) { int resultado = 0; try { this.bd.open(); this.bd.beginTransaction(SqlJetTransactionMode.READ_ONLY); this.table = this.bd.getTable(nombretabla); // Con esta función buscamos en la t...
7f739026-8cd5-422d-aa07-c16863010abb
4
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (!(obj instanceof Picking)) return false; Picking other = (Picking) obj; if (id.equals(other.id)) return false; return true; }
05a05d3c-9c5e-42cd-a23c-cd0d2017f3ff
9
public Point findPointIntersection (Point P1, Point P2, Point P3, Point P4){ a1=P1.getY()-P2.getY(); a2=P3.getY()-P4.getY(); b1=P2.getX()-P1.getX(); b2=P4.getX()-P3.getX(); c1=P1.getX()*P2.getY()-P2.getX()*P1.getY(); c2=P3.getX()*P4.getY()-P4.getX()*P3.getY(); xDe...
fcb3c01d-0b21-4d3f-81e9-196b7505c2a2
7
private String shrtTip() { String tt = shorttip(); if (tt != null) { tt = RichText.Parser.quote(tt); if (meter > 0) { tt = tt + " (" + meter + "%)"; } if (FEP != null) { tt += FEP; } if (curio_stat !=...
7e48ba20-149f-4b41-87c4-eaec291f30c4
0
public void setUpdateExisting(boolean updateExisting) { this.updateExisting = updateExisting; }
8848a5e7-f6be-417f-95b7-1977d3e0bdea
4
public long playGame(final Board start, List<Integer> nextPiece) { System.out.println(start); System.out.println("avail moves: " + nextPiece.size()); Board curBoard = new Board(start); int moves = 0; long startTime = System.nanoTime(); List<Board.Direction> moveList; do { moveList = this.nextMove...
a5b24890-9338-4e3c-8016-b50da47d60a7
5
MethodConstructorStringConverter(Class<T> cls, Method toString, Constructor<T> fromString) { super(cls, toString); if (cls.isInterface() || Modifier.isAbstract(cls.getModifiers()) || cls.isLocalClass() || cls.isMemberClass()) { throw new IllegalArgumentException("FromString constructor must ...
c7e45e41-60b9-4aac-b134-212627de74d0
5
public void parseInput(String state) { char type = state.charAt(0); if (type != ':') { return; } type = state.charAt(1); String value = state.substring(3); if (type == 'l') { this.light = Integer.decode(value); } if (type == 'r') { this.relayA = Integer.decode(value) == 1; } if (type == '...
838a29f9-e0af-4ea1-ab40-3b5d8247a957
7
public static String stringOfCollection(Collection<?> collection, String sep, String prefix, String suffix) { StringBuilder res = new StringBuilder(prefix == null ? "" : prefix); if (collection != null) { boolean first_element = true; for (Object elem : collection) { if (elem != null) { res.append((f...
bef330dc-71c7-4e2a-8dd0-bc5e62a835d3
1
private String stackString() { Object[] o = STACK.toArray(); StringBuffer sb = new StringBuffer(); for (int i = o.length - 1; i >= 0; i--) sb.append(o[i]); return sb.toString(); }
0fb36514-54d1-4260-8e01-990f2a16f54d
5
public static Map<String, String> simpleUPnPcommand(String url, String service, String action, Map<String, String> args) throws IOException, SAXException { String soapAction = "\"" + service + "#" + action + "\""; StringBuilder soapBody...
b03e9418-7ab3-4114-adfb-bf32f06a0d8a
2
public void save() throws SQLException { if (groopNumber == -1) groopNumber = GetGroops.build().addGroop(this); else if (updated) GetGroops.build().save(this); }
703cbdec-7804-4e33-ad7f-aa72286aa1d9
0
public SqlErrorFrame() { initComponents(); }
2326d75f-ba10-4757-987f-a5cca371e7aa
7
public void draw(Graphics2D g) { g.setColor(Color.WHITE); if(onFire) g.drawImage(fireImage, xPos, yPos, null); else if(SimCityGui.GRADINGVIEW) { g.drawString("W"+mNum, xPos+10, yPos-5); } else { g.drawImage(image, xPos, yPos, null); } switch(state) { ...
dd6ae27d-d61a-4c50-9f07-9b3d264dafc1
3
public boolean checkBook() { boolean hasBook = false; ArrayList<Card> list = getList(); HashMap<Integer, Integer> map = new HashMap<Integer, Integer>(); for (int i = 0; i < list.size(); i++) { int numb = list.get(i).getCardNum(); if (!map.containsKey(numb)) { map.put(numb, 1); } else { int qty ...
0c2c6f35-5cb0-46cc-a1f5-6b3f788f76eb
7
@Override public void run() { // loop to receive broadcasted UDP packets active = true; DatagramPacket packet = new DatagramPacket( new byte[NetInterface.UDP_PACKET_SIZE], NetInterface.UDP_PACKET_SIZE); while (active) { try { // blocks thread until reception of a packet if (verbose) { S...
37d1c32a-5d90-4821-8e9b-962873a8820c
2
public void insert(LinkedListRange node, LinkedListRange root) { if (root == null) { root = node; return; } while (root.getNext() != null) root = root.getNext(); root.setNext(node); }
b4e63417-3f8d-4beb-be48-3d256afe4b02
5
private IShelf setPosition(IItem item) throws TaskFailureException { for (int i = 1; i < 4; i++) { try { Aisle aisle = (Aisle) manager.get("A" + i); List<Rack> racks = aisle.getRacks(); for (int j = 0; j < racks.size(); j++) { Rack ...
980fb1ff-5363-44e0-9e10-c481704e86c8
2
@Override public String[] getTableRenameStatements(String oldTableName, Class<?> oldClass, String newTableName, Class<?> newClass) { StringBuilder sb = new StringBuilder("RENAME TABLE "); sb.append(oldTableName); sb.append(" TO "); sb.append(newTableName); return new String[] { sb.toString() }; }
3d911f93-a088-4428-a088-d0f9ef6e87b7
6
public void doMission() { final Unit unit = getUnit(); String reason = invalidReason(); if (reason != null) { logger.finest(tag + " broken(" + reason + "): " + this); return; } // Make random moves in a reasonably consistent direction, // checking...
ef9d8428-c5e7-4975-9223-7881c6917176
8
@SuppressWarnings("fallthrough") private void beforeValue(boolean root) throws IOException { switch (peek()) { case NONEMPTY_DOCUMENT: if (!lenient) { throw new IllegalStateException( "JSON must have only one top-level value."); } // fall-through case EMPTY_DOCUMENT: ...
ef5138de-18e1-4b80-89b0-a433aacf7242
6
public void checkPawn() { if (color == 'W') { for (int i = 0; i < 8; i++) { if (aiarr[i][0].toString().charAt(1) == 'P') { aiarr[i][0] = new Queen(true); } } } if (color == 'B') { for (int i = 0; i < 8; i++) { if (aiarr[i][7].toString().charAt(1) == 'P') { aiarr[i][7] = new Queen(fa...
12534c0a-96c4-413d-814e-480950068af6
4
public static byte[] decodeFromFile( String filename ) throws java.io.IOException { byte[] decodedData = null; Base64.InputStream bis = null; try { // Set up some useful variables java.io.File file = new java.io.File( filename ); byte[] bu...
de42c1b8-c415-4983-a561-0997ff4de6df
7
private void searchByLivreEmprunt(String toSearch) throws Exception { try { StringTokenizer st = new StringTokenizer(toSearch, " "); if (st.countTokens() != 0) { List<String> list = new ArrayList<>(); for (int i = 0; i < st.countTokens() + 1; i++) { ...
0206e4a3-9d14-4d8b-8d13-62f10b26e36d
5
public synchronized void run() { try { while (true) { Thread.sleep(time - 14); secound += 1; if (secound >= 60) { minute += 1; secound = 0; } if (minute >= 60) { hour += 1; minute = 0; } if (hour >= 1) { hour = 0; minute = 0; secound = 0; } } } catch(Exception e) { e.printStack...
abc593f5-e46c-4543-8d43-889dc7092368
4
public File wavCombiner(File synthFile, File inputFile){ Synthesizer synth = JSyn.createSynthesizer(); LineOut lineOut; synth.add(lineOut = new LineOut()); synth.start(); FloatSample sample; FloatSample sample2; try { // AddUnit mixer = new AddUnit(); sample = SampleLoader.loadFloatS...
019a15bd-f5fa-4738-82c6-b013de10c077
9
void paintImage(PaintEvent event) { GC gc = event.gc; Image paintImage = image; /* If the user wants to see the transparent pixel in its actual color, * then temporarily turn off transparency. */ int transparentPixel = imageData.transparentPixel; if (transparentPixel != -1 && !transparent) { image...
a1e9d743-e88c-464a-a726-39d499d06e71
4
public Transporte recebeuPSH(int n_seq, InetAddress adress){ Transporte t1=new Transporte(initTransportePSH); this.Recebidos.lock(); ArrayList<DatagramPacket> lista = (ArrayList<DatagramPacket>) this.Recebidos.lista.clone(); this.Recebidos.unlock(); for(DatagramPacket ...
7c629d29-e674-4260-a2cf-f7d630d69e82
7
private static Icon getIconForValue ( BencodeTreeModel model, BencodeTreeNode node ) { if ( node.getParent() == null ) { return ICON_ROOT; } Value<?> value = node.getValue(); if ( value instanceof IntegerValue ) { return ICON_INTEGER; } else if ( value instanceof StringValue ) { if ( ( (Str...
6ad65efe-5ba5-4550-baf7-294e43ac3c4b
8
private void fillMaxTotalScores() { int numEntries = entryList.size(); Vector cellList = new Vector(16); rootPane.getAttributeCells(cellList); double[] accumulatedRatios = new double[numEntries * noOfUsers]; int j = 0; for (int i = 0; i < numEntries; i++) {//for each alternative ...
41f43131-cf40-4500-b4f5-055059510cf0
0
public static void main(String[] args) { // Thread.setDefaultUncaughtExceptionHandler(new Thread.UncaughtExceptionHandler() { // // @Override // public void uncaughtException(Thread t, Throwable e) { // System.out.println("e: " + e.getMessage()); // } // // }); Thread.currentThread().setUncaughtExceptio...
ddeebf2c-8f1d-433e-8b99-8fa919b24721
4
private double noise2D(double xin, double yin) { double n0, n1, n2; // Noise contributions from the three corners // Skew the input space to determine which simplex cell we're in double s = (xin+yin)*F2; // Hairy factor for 2D int i = fastfloor(xin+s); int j = fastfloor(yin+s); double t = (i+j)*...
d24eed64-318c-4da8-a501-933793b4f017
5
public Ants(int loadTime, int turnTime, int rows, int cols, int turns, int viewRadius2, int attackRadius2, int spawnRadius2) { this.loadTime = loadTime; this.turnTime = turnTime; this.rows = rows; this.cols = cols; this.turns = turns; this.viewRadius2 = viewRa...
17a25f41-38f1-4ff1-b8d4-5b7d253cfb9f
1
public static Set getUselessStates(Automaton a) { if (a.getInitialState() == null) { throw new IllegalArgumentException( "Automata does not have an initial state!"); } Set finalized = findFinal(a); Set initialized = findInitial(a); Set useless = new HashSet(Arrays.asList(a.getStates())); finalized.r...
44e4a617-65b5-4962-98e5-7352d1f1f31e
3
public MenuPanel(){ players = new ArrayList<Player>(); nameLabel = new JLabel("Name: "); nameField = new JTextField("",20); addButton = new JButton("Add Player"); startButton = new JButton("Start Game"); nameLabel.setLabelFor(nameField); updateAddButton(); updateStartButton(); nameField.g...
8613d61b-897b-489d-a5d4-00f76722a25e
9
private boolean calulateHueSaturation(ij.process.ImageProcessor ip) { boolean huesaturation = false; int w = ip.getWidth(); int h = ip.getHeight(); int [] h_hist = new int [360]; for (int i=0; i<360; i++) { h_hist[i] = 0; } //set image as current window ImagePlus hs_imp; hs_imp = Win...
4e145e36-e2e2-4abc-809e-023967fc7190
4
public AlphaImageDemo() { MinuetoWindow window; // The Minueto window MinuetoImage imageTank; // MinuetoImage used to store // the image we will load. MinuetoImage imageBackGround; // Background image double x; // Position to draw the image. if (MinuetoTool.isWindows()) ...
6e73bc83-922b-4d29-bf8d-1f54bc728420
4
private Object getIdString() { try { Field idField = this.getClass().getDeclaredField("id"); return idField.get(this); } catch (SecurityException e) { return ""; } catch (NoSuchFieldException e) { return ""; } catch (IllegalArgumentException e) { return ""; } catch (IllegalAccessException e) { ...
ef2fcc49-ac61-4f79-a56c-ae70b9c287d1
2
public synchronized User detachUser(String nickname) { for (User user : model) { if ( user.getNickname().equals(nickname) ) { model.remove(user); contentChanged(); return user; } } return null; }
5c681352-cbfd-4cf8-921b-a136b7894c1b
9
private String get_alphabet_morse(int cnt) { StringBuilder sb=new StringBuilder(); int first_line=cnt/9; switch(first_line) { case 0: sb.append("."); break; case 1: sb.append("-"); break; case 2: sb.append("x"); break; } int second_line=cnt%9; if(second_line>=0 && second_line<=2) ...
952c2d4b-fda6-46da-8bbd-46db996f07c1
2
public void setConfiguration (int index) throws USBException { int status; if (index < 0 || index > descriptor.getNumConfigurations ()) throw new IllegalArgumentException (); throw new USBException ("can't set configuration (unimplemented)", 0); /* synchronized (lock) { if ((status = setConfig...
6ef8cc0d-f67f-4df6-bab2-1267c5987b33
4
private void createEntry(String pFileWildcardPath, Map<String, String> pInstructionMap) throws ExParser { //Get and validate the loader name String lLoader = pInstructionMap.remove(CONFIG_INSTRUCTION_LOADER); if(XFUtil.isNull(lLoader)){ throw new ExParser("Invalid config file definition - 'Loa...
4a908c72-b054-44f9-9c35-c80a6ddd3290
4
void doItCompareDomains() { for (String name : _a1.keySet()) { Chromosome c1 = _a1.get(name); Chromosome c2 = _a2.get(name); if (c2 != null) { StatisticResultComparisonDomains r1 = c1.analyze(); r1.setComparisonResult(c1.comparisonOfDomain...
f98809df-48ef-4485-86a5-003cb42170eb
7
@Override public void run() { System.out.println("Hello, The Host is started"); while(nm.comp.isRunning()){ try { Socket socket = serverSocket.accept(); Logger.println("Connection from IP: " + socket.getInetAddress()); DataOutputStream out = new DataOutputStream(socket.getOutputStream()); DataIn...
43b6eebb-83fe-43e8-b4f6-8d4dfd1b2296
2
@SuppressWarnings("rawtypes") public void valueChanged(ListSelectionEvent e) { if (e.getValueIsAdjusting() == false) { JList list = (JList) e.getSource(); String selectedValue = (String) list.getSelectedValue(); String oldValue = textCom...
0be4fe98-3b8e-4950-95fd-4978585815d2
4
private void initializeResultsFile() { if (trace_flag == false) { return; } // Initialize the results file FileWriter fwriter = null; FileWriter fwriterFin = null; try { fwriter = new FileWriter(super.get_name(), true); fwr...
26bdb5ad-367d-46ed-b693-b0cfd08a03a1
8
@Override public void run() { /* Todos los resultados posibles de X*10^r sin repetir * Ejemplo: 1 dado, 2 caras, 2 bandejas: * [0, 1, 2, 20, 21] */ if(trays == 1){ resultado = diceNumber * faces + 1; }else{ Set<Integer> lcombinaciones = new HashSet<Integer>(); for(int tray = 0; tray<tr...
f8e98233-9c5f-4a24-9d95-21fd40c1173e
6
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; AcompanhamentoFisico other = (AcompanhamentoFisico) obj; if (idAcompanhamentoFisico == null) { if (other.idAcompanhamentoFisico != null) r...
4bca2792-cb9a-485a-a500-f39ac69e651f
0
public static long ncr(int n, int k) { return factorial(n).divide(factorial(n-k).multiply(factorial(k))).longValue(); }
a72aff74-a051-40c9-bfe6-f2745d5added
6
public static String getValidDnaCharsOrN( String inString ) { StringBuffer buff = new StringBuffer(); for ( int x=0; x < inString.length(); x++ ) { char c = inString.charAt(x); if ( c == 'A' || c == 'C' || c == 'G' || c == 'T' || c == 'N' ) buff.append(c); } return buff.toStrin...
7355b5a2-e949-4641-8a77-5e9414d28b00
4
@Override public double[] evaluate(double[] parameters) { if(this.numberOfEvaluation <= 0){ return null; } this.numberOfEvaluation -= 1; controllers.singlePlayer.ucbOptimizerAgent.Agent.parameters = parameters; double[] results = new double[this.getNumberOfObjectives()]; for(int i=0; i<this.gamePa...
133b1394-b3b9-43da-83bc-fc844e3297f7
0
@Test public void testPropertiesConfiguredInstanceName() throws Exception { assertEquals( scheduler.getSchedulerName(), INSTANCE_NAME ); }
d80bff06-3a4d-4992-9928-bef31f6c5532
5
@Override public boolean equals(Object obj) { if (obj == this) { return true; } if (!(obj instanceof Handle)) { return false; } Handle h = (Handle) obj; return tag == h.tag && owner.equals(h.owner) && name.equals(h.name) && desc...
c84d7c73-a96a-4832-8d4d-95ee2e06e707
5
static final boolean method3455(String string, int i) { anInt4324++; if (string == null) return false; for (int i_0_ = 0; ((Class348_Sub42_Sub12.ignoreListLength ^ 0xffffffff) < (i_0_ ^ 0xffffffff)); i_0_++) { if (string.equalsIgnoreCase(Class122.aStringArray1808[i_0_])) return true; if (stri...
50ba1067-0fb8-4445-b017-cc56742edae8
1
public static void save(HashMap<String, ArrayList<String>> map, String path) { try { ObjectOutputStream oos = new ObjectOutputStream( new FileOutputStream(path)); oos.writeObject(map); oos.flush(); oos.close(); // Handle I/O excepti...
b3a75094-71fa-4273-a1fc-fd43948441c9
6
void findBeginningAndFinishLocations() { char character; beginning = null; finish = null; for (int column = 0; column < dimension; column++) { for (int row = 0; row < dimension; row++) { character = getValueAtLocation(column, row); if (characte...
4a16f61b-eeca-46dc-a2fe-ab1b408beb97
9
public void tick(){ if(y + ny >= 0 && y + ny <= maxY - height){ y += ny; }else{ ny *= -1; y += ny; } if(x + nx >= 0 && x + nx <= maxX -width){ x += nx; }else{ nx *=-1; x += nx; } if(x <= 0){ x = 0; } if(x >= maxX -width){ x = maxX -width; } if(y >= maxY -height){ y = max...
f097043d-cf96-4ef1-a35a-c6b62cc0d729
2
public PrecisionLab getPrecisionLab() { precisionLabLock.readLock().lock(); if (precisionLabInstance == null) { precisionLabLock.readLock().unlock(); precisionLabLock.writeLock().lock(); try { if (precisionLabInstance == null) { precisionLabInstance = createPrecisionLab(); } } finally ...
cbab4f66-2b21-4eaa-a2c6-383477c21de1
0
public JLabel getjLabelMotifVisite() { return jLabelMotifVisite; }
86c44c01-9be1-47a4-a263-7fc22e80f35a
2
public static void setUpEntities(){ bat = new Bat(WIDTH / 2, HEIGHT -30 , 80, 20); ball = new Ball(bat.getX() + 20, bat.getY() - 30, 10, 10); ball.setDY(.1); int xPos = 20, yPos = 20; for (int i = 0; i < 15; i++) { bricks.add(new Brick(xPos, yPos, true)); ...
357bdd9e-8a04-40d9-b992-0c540adf1b0a
8
private boolean worldChanged() { //Wenn sich die Original-Linienanzahl veraendert hat if(numlines != Reflines.size()) { //Originallinien kopieren Lines.clear(); for(int i=0; i<Reflines.size(); i++) { int[] x = new int[4]; x[0] = Reflines.elementAt(i)[0]; x[1] = Reflines.elementAt(i)[1]; ...
3c7aaca9-49c7-4afc-80ff-83d8790cf34b
2
@POST @Path("/v2.0/subnets") @Produces(MediaType.APPLICATION_JSON) public Response createSubnet(final String request) throws MalformedURLException, IOException{ //Convert input object NetworkData into a String like a Json text Object sub; sub = JsonUtility.fromResponseStringToObject(request,Subnet.class); St...
c586e446-d9e5-47c2-8954-027474aeb8bd
1
static void handleUDP(DatagramSocket udpSocket) throws IOException { while (true) { //will represent the received data as bytes byte[] receiveData = new byte[1024]; //sent data as bytes byte[] sendData = new byte[1024]; //represent received packet ...
48062220-0d4b-44a8-a79b-472fc9f212d1
5
@Override public void deserialize(Buffer buf) { msgId = buf.readShort(); if (msgId < 0) throw new RuntimeException("Forbidden value on msgId = " + msgId + ", it doesn't respect the following condition : msgId < 0"); timeStamp = buf.readUInt(); if (timeStamp < 0 || timeSta...