method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
27161562-3f57-48c9-9196-3e4e79433b15
4
public static void main(String[] args) throws IOException { if (args.length != 1) { System.err.println("Usage: java KnockKnockServer <port number>"); System.exit(1); } int portNumber = Integer.parseInt(args[0]); try ( ServerSocket server...
47e0b259-283c-4198-9d48-893dbd6c2e0b
7
public void update() { if (playing) { long time = System.currentTimeMillis(); if ( time - lastTime > frameDuration[currFrame] && finalFrame != 0) { currFrame++; lastTime = time; ...
5106f9a3-0ed3-4899-b1b0-355bbff5da9f
7
@Override public List<Method> findMethodsCalled(String methodName, InputStream data) { ArrayList<Method> listMethods = new ArrayList<>(); XMLInputFactory xmlif = XMLInputFactory.newInstance(); try { XMLStreamReader xmlsr = xmlif.createXMLStreamReader(data); SAXBuilder builder = new SAXBuilder(); int e...
527cbe9e-6dc1-4d34-9d19-a3d2ebc6a42c
5
protected int upgradeHP() { if (upgrades == null) return 0 ; int numUsed = 0 ; for (int i = 0 ; i < upgrades.length ; i++) { if (upgrades[i] != null && upgradeStates[i] != STATE_INSTALL) numUsed++ ; } if (numUsed == 0) return 0 ; return (int) (baseIntegrity * UPGRADE_HP_BONUSES[numUsed]) ;...
98bf68e8-8330-4155-b392-79dd6fce5f66
2
public static JSONArray fetchByNumber(final String token, final String objType, final Long number) throws IOException { String url = ApiProperties.get().getUrl() + objType + "/number/" + number; String obj = fetchData(url).toString(); JSONObject jsonObject = new JSONObject(obj); JSONArray results = new JSON...
23833729-b1d0-425b-b019-9085e9c4adef
2
public List<Class<? extends Data>> getAllDataTypesFromEntity( long someId ) { // return new ArrayList<Class<? extends Data>>( _dataCenter.getDataCore().getEntity_Data_Table().get( someId ).keySet() ); }
0b140b15-1e8f-4a4c-ae30-711d2b3a9604
9
private static final Object number(CharacterIterator it,StringBuilder buf) { int length = 0; boolean isFloatingPoint = false; buf.setLength(0); char c = it.current(); if (c == '-') { buf.append(c); c = it.next(); } length += addDigits(it,c,buf...
87419e82-338a-4705-8862-bfd1a2caa4fd
7
public final void initUI() { amiListe = new JComboBox<UserProfile>(); //liste déroulante servant à stocker les amis. panel = new JPanel(); //panel principal servant à stocker tous les autres éléments. getContentPane().add(panel); //On le rajoute à la fenêtre. /* Défini les caractéristiques du panel princ...
58d85691-1e9f-4a07-9a65-3287f3fcf80e
2
public double calculateCommission() { this.commision = 0; this.commision = this.speaker.getRate() * this.duration; int dayOfWeek = this.getDayOfWeek(this.eventDate); if(dayOfWeek == Calendar.SATURDAY || dayOfWeek == Calendar.SUNDAY) { this.commision = this.commision * 1.25; } // add transportation fee...
bda25179-cce6-4831-9a85-5f9cdd90a649
2
@Override public String toString() { String g = G().V() + " vertices " + G().E() + " edges\n"; for (int v = 0; v < G().V(); v++) { g += name(v) + "(" + v + "): "; for (int w : G().adj(v)) g += name(w) + "(" + w + "), "; g += "\n"; } return g; }
46307761-4c0c-436b-bd3e-6c146d24728e
8
private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton2ActionPerformed int isbn=Integer.parseInt(jTextField9.getText()); String title=jTextField10.getText(); int num=Integer.parseInt(jTextField23.getText()); ArrayList<Str...
4e83e763-1399-4c78-9ced-1d40b3c81bee
9
@Override public Class<?> getColumnClass(int indiceColuna) { switch (indiceColuna) { case 0: return String.class; //fornecedor case 1: return String.class; //job case 2: return String.class; //setor origem case 3: ...
f0cf29f8-5f5c-451d-8fdd-b1cb59b4396a
0
public TBShopFetcher(RequestWrapper requestWrapper) { super(requestWrapper); }
f20f1d5f-3317-463c-8581-fe62016c8434
9
public static List<Event> load(){ Connection conn = null; Statement stat = null; ResultSet result = null; List<Event> list = new ArrayList<Event>(); try { Class.forName("com.mysql.jdbc.Driver").newInstance(); conn = DriverManager.getConnection("jdbc:mysql://localhost:3306/gent?user=root&password=...
8f0860bd-6716-4648-8704-775db08ad54b
9
public List<String> complete(final String prefix, final int count) { // 1. Find the position of the prefix in the sorted set in Redis if (null == prefix) { return Collections.emptyList(); } int prefixLength = prefix.length(); Long start = redis.zrank(redisKey, prefix)...
52b2160b-60ca-4ed9-98a8-3cf4b38792a6
5
private static <T extends Comparable<T>> void maxHeapify(T array[], int index, int heapSize){ int leftIndex = getLeftChildIndex(index); int rightIndex = getRightChildIndex(index); int largestIndex = index; if(leftIndex <= heapSize && array[index].compareTo(array[leftIndex]) == -1) largestIndex = leftIn...
b61c8509-0bfe-4d4b-8ab6-ef7b5546bbb3
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 Designation)) { return false; } Designation other = (Designation) object; if ((this.id == null && other.id != n...
08ba5351-f6e4-4de9-a0e2-e8bdb7c5cff8
8
public void consume(final Throwable eMain) { SwingUtilities.invokeLater(new Runnable() { public void run() { Throwable e = getRootCause(eMain); // Get the last bit of the Java console stdout String outMsg = ""; if (stdoutDoc != null) { try { int nsave = 4000; int docLen = stdoutDoc.getLe...
7c6e95a5-74be-4275-8069-8be3f3caa2b1
3
public List getEntitiesWithinAABB(Class var1, AxisAlignedBB var2) { int var3 = MathHelper.floor_double((var2.minX - 2.0D) / 16.0D); int var4 = MathHelper.floor_double((var2.maxX + 2.0D) / 16.0D); int var5 = MathHelper.floor_double((var2.minZ - 2.0D) / 16.0D); int var6 = MathHelper.floor_...
83c2e0fe-d2ce-4128-988b-65cdbf39f4b1
4
public void insert(BinaryTreeNode n) { BinaryTreeNode runner = this.root; BinaryTreeNode parentPostion = null; while (runner != null) { parentPostion = runner; if (n.compareTo(runner) <= 0) { runner = runner.left; } else { runne...
5e6e4e24-4d89-414d-96ce-24fb6e245821
7
private boolean load() { boolean returnval = true; try { if (locFile.exists() & locFile.canRead()) { BufferedReader br = null; try { br = new BufferedReader(new InputStreamReader(new FileInputStream(locFile), Charset.forName("UTF-8"))); ...
811bdc27-3c0f-4bb4-8dc7-8c049e34555d
4
public boolean collisionCheck(int posX, int posY) { if(posX > this.posX && this.posX+width > posX && posY > this.posY && this.posY+height > posY) { return true; }else { return false; } }
6859683b-14f8-4325-b2dc-8fcfeef2f0c5
6
@SuppressWarnings("unchecked") public static List<Card> deSerialiseCards(){ List<Card> deser_members = null; try { FileInputStream input_file = new FileInputStream("cards.ser"); ObjectInputStream input = new ObjectInputStream(input_file); deser_members = (List<Card>) input.readObject(); input.close();...
32feb27a-49ec-4b78-a520-5182aa1dc8b6
1
private boolean jj_2_20(int xla) { jj_la = xla; jj_lastpos = jj_scanpos = token; try { return !jj_3_20(); } catch(LookaheadSuccess ls) { return true; } finally { jj_save(19, xla); } }
3d8a922e-2fd4-4edb-9850-7218dbfd2c49
4
private Node parseDecision() { Decision result = new Decision(this); Expression expr = new Expression(this); result.append(expr); while (offset < input.length()) { char c = input.charAt(offset); if (c == ')') { offset++; break; } else if (c == '|') { offset++; expr = new Expre...
a85fab3a-9491-4bb1-8f2a-bfaa7115c065
4
public int setLoyalty(String playerName, double loyalty) { String SQL = "UPDATE " + tblSkills + " SET " + "`leadership` = ? WHERE `player` LIKE ? ;"; int updateSuccessful = 0; Connection con = getSQLConnection(); PreparedStatement statement = null; try { statement = con.prepareStatement(SQL); stateme...
9af9c90d-8845-48aa-af01-b2b18c652d1f
2
public void render() { glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); glBindTexture(GL_TEXTURE_2D, texture.id); glTranslatef(1*HouseGenerator.tWidth*globalWidth2*0.5f, 0f, 1*HouseGenerator.tDepth*globalHeight2*0.5f); glRotatef(-1, 0, 1, 0); glTranslatef(-1*HouseGenerator.tWidth*globalWidth2*0.5f, 0f,...
6068a589-3ba5-4f75-b83d-1058035da5a2
7
public int method544(int i, float f) { if(i == 0) { float f1 = (float)anIntArray668[0] + (float)(anIntArray668[1] - anIntArray668[0]) * f; f1 *= 0.003051758F; aFloat671 = (float)Math.pow(0.10000000000000001D, f1 / 20F); anInt672 = (int)(aFloat671 * 65536F); } if(anIntArray665[i] == 0) return 0; ...
84cf80a5-4708-4c16-a900-ec0c3ece7c59
7
public static IMac getInstance(String name) { if (name == null) { return null; } name = name.trim(); name = name.toLowerCase(); if (name.startsWith(HMAC_NAME_PREFIX)) { return HMacFactory.getInstance(name); } IMac result = null; if (name.equalsIgnoreCa...
4c08af21-584b-4a5a-88f3-99f84057edcc
6
@Override public boolean equals(Object obj) { if (this == obj) return true; if (!super.equals(obj)) return false; if (getClass() != obj.getClass()) return false; SpanTermQuery other = (SpanTermQuery) obj; if (term == null) { if (other.term != null) return false; ...
097c153d-58c1-4c38-a09f-c96601000e2a
4
public static void main(String args[]) throws Exception { try { String serverHostname = new String ("127.0.0.1"); if (args.length > 0) serverHostname = args[0]; BufferedReader inFromUser = new BufferedReader(new InputStreamReader(System.in)); ...
df957d1f-7fc8-4a8e-8d36-65caf5c70ef8
3
@Override public void deserialize(Buffer buf) { cellId = buf.readShort(); if (cellId < 0 || cellId > 559) throw new RuntimeException("Forbidden value on cellId = " + cellId + ", it doesn't respect the following condition : cellId < 0 || cellId > 559"); objectGID = buf.readShort()...
6f259fe4-15f4-4be4-a36b-4d9ab2fa673f
7
protected void generateMoves(List<Movement> movesList, Piece piece) { /************** GENERACIÓN DE LOS MOVIMIENTOS *************/ bbPieceOccupation = bbPiecesOccupation[piece.index]; numPieces = Long.bitCount(bbPieceOccupation); for(int i = 0; i < numPieces; i++) { pieceSquar...
282dcd3f-f667-4e76-8475-8f08a1659310
5
public static int[] computeBuying(int[] arr) { int[] results = { -1, -1, -1 }; // error check - only one data point if (arr.length == 1) { results[0] = results[1] = results[2] = 0; return results; } int min = 0; int max = 0; int prof = 0; int tempMin = 0; int tempMax = 0; int tempProf = 0; ...
6c1d8229-0abc-46c0-9ac0-d3f890e63cd1
5
public Map<Integer, Integer> getGeneSpans(String text) { Map<Integer, Integer> begin2end = new HashMap<Integer, Integer>(); Annotation document = new Annotation(text); pipeline.annotate(document); List<CoreMap> sentences = document.get(SentencesAnnotation.class); for (CoreMap sentence : sentences) {...
828fc2fc-e6be-49cc-b105-ce8515141a56
3
public TrainListFrame(Title myTitle, TrainSchedule TS, String filePath) throws IOException { setBackground(new Color(173, 216, 230)); setLayout(null); JButton btnUpload = new JButton("Upload another schedule"); btnUpload.addMouseListener(new MouseAdapter() { @Override public void mouseClicked(MouseEven...
16fb17c2-3742-44ab-b9f7-3242579f49d8
9
private static <T extends Comparable<T>, E> void printNodeInternal(List<Node<T,E>> nodes, int level, int maxLevel) { if (nodes.isEmpty() || isAllElementsNull(nodes)) return; int floor = maxLevel - level; int endgeLines = (int) Math.pow(2, (Math.max(floor - 1, 0))); int first...
b4d3cac0-a825-4f64-83a1-f9db8c4bf029
9
public void testNeighbourshipSimple() { // the middle segment ("segmentB") has whether "segmentA" or "segmentC" // as its left or right neighbour (depending on orientation): assertTrue((segmentB.getNeighbour(0) == segmentA && segmentB .getNeighbour(1) == segmentC) || (segmentB.getNeighbour(0) == segmentC...
8e7d92c2-c714-47cd-954a-8bce15dd6524
6
private int handleJumpBankRelative(int address, int jumpAddress, CPUState s, int jumpType, boolean reachable) { if(jumpAddress < 0x4000) // home bank jump return handleJumpFull(address,jumpAddress,s, jumpType, reachable); else if(jumpAddress >= 0x8000) // non-ROM jump System.out.pr...
51cbe6bb-74e4-458d-b2b5-36295b48deaf
2
public boolean isMt() { String iduc = id.toUpperCase(); return iduc.equals("M") // || iduc.startsWith("MT") // || (iduc.indexOf("MITO") >= 0) // ; }
d0ee8231-8226-4990-b188-0760cef4c686
6
public void printAllCombinationNonRecur(String number){ int[] answer=new int[number.length()]; for(int i=0;i<answer.length;i++){ answer[i]=0; } while(true){ for(int i=0;i<number.length();i++){ System.out.print(mapping[Integer.parseInt(number.substring(i,i+1))].charAt(answer[i])); } System.out.pr...
3a3d2734-a64f-4af8-98ee-f4444717cc61
4
public static void main(String args[]) { try { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); } catch (ClassNotFoundException e1) { e1.printStackTrace(); } catch (InstantiationException e1) { e1.printStackTrace(); } catch (IllegalAccessException e1) { e1.printStackTrace(); } ...
ad027d68-dc19-442f-aaae-62f60e753372
8
public MOB getJudgeIfHere(MOB mob, MOB target, Room R) { LegalBehavior B=null; if(R!=null) B=CMLib.law().getLegalBehavior(R); final Area legalA=CMLib.law().getLegalObject(R); if((B!=null)&&(R!=null)) for(int i=0;i<R.numInhabitants();i++) { final MOB M=R.fetchInhabitant(i); if((M!=null)&&(M!=mo...
40c30ba5-593f-4ede-b4b0-bb1a4c7ec1fa
5
public TreeSet<Assign> extractBest(int num, TreeSet<Assign> used) { // Sanity check assert num <= numLectures : "Attempting to extract more assignments than possible"; HashMap<String, Assign> fixedAssignments = (HashMap<String, Assign>)environment.getFixedAssignments(); TreeSet<Assign> bestAssignments =...
80c5d6d8-f8eb-4da6-bd1e-b2b5cf98b7a5
7
private void initSegments(double With,double Height,double radius) { SegmentModel bsegments = new SegmentModel(base.getInterpolated(With,Height,radius)); segments = new SegmentModel[n]; double angle = 2*Math.PI/n; for (int i = 0; i<segments.length;i++){ segments[i] = Segment...
3e0b852b-2e5c-4be1-b610-27e4a789e1a6
9
@Override public void paint( Graphics g ) { if( hdrImage == null ) { g.setColor(Color.BLACK); g.fillRect(0, 0, getWidth(), getHeight()); } else { int scale = 2; while( hdrImage.getWidth()*scale <= getWidth() && hdrImage.getHeight()*scale <= getHeight() ) { ++scale; } --scale; int left ...
7ef98fb9-dfd8-44ba-89b2-96771b263c4f
9
private Point getTargetBlock(Point cur){ int cnt = 0; if (this.maze[cur.x][cur.y + 1] == false) {cnt++;} if (this.maze[cur.x][cur.y - 1] == false) {cnt++;} if (this.maze[cur.x + 1][cur.y] == false) {cnt++;} if (this.maze[cur.x - 1][cur.y] == false) {cnt++;} if (...
510b429d-f030-4288-80f1-bf4cb157b5f9
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...
8785998d-aed5-41fd-8d47-3a02528e4a0a
0
public static void main(String[] args) throws ClassNotFoundException, IOException { Worm w1 = new Worm(6, 'a'); System.out.println("w1 = " + w1); ObjectOutputStream out = new ObjectOutputStream(new FileOutputStream("worm.out")); out.writeObject("Worm storage\n"); out.writeObject...
0f73bc77-d3e4-4a71-82a5-599c8fa1f44a
0
private boolean _hasBeenModified() { File config_file = new File(ConfigurationManager.config_file_path); Long this_time = config_file.lastModified(); return (this_time > this.read_time); }
eee1ec04-fa83-4387-bdae-df32588d90f8
1
public static void sort(int[] array, int start, int end) { if(start >= end) { return; } int i = sortUtil(array, start, end); sort(array, start, i - 1); sort(array, i + 1, end); }
784b9706-4e74-498f-8baa-cbdec4b3f3f6
8
private Map<String, String> validateFields(Map<String, String> validationMap){ Map<String, String> resultsMap=new HashMap<String, String>(); int intValue=0; for( Map.Entry<String, String> entry:validationMap.entrySet()){ if(entry.getKey().equals("healthrec")){ try{ intValue=Integer.parseInt(entr...
585bbd0a-a01d-4ea3-9ee0-57b3460b74c2
3
@Override public void execute( CommandSender sender, String[] args ) { if ( !( sender.hasPermission( "bungeesuite.reload" ) || sender.hasPermission( "bungeesuite.admin" ) ) ) { if ( sender instanceof ProxiedPlayer ) { ProxiedPlayer p = ( ProxiedPlayer ) sender; p....
a5d66c5e-56dd-459e-a2a5-752f9a65327e
0
public Tool getCurrentTool(){ return currentTool; }
6fa7044c-1bd3-447d-b42f-3ff49ac3f7da
8
public ArrayList<Integer> generateWhitePawnDestinations( int position ) { ArrayList<Integer> destinations = new ArrayList<Integer>(); if ( !hasPieceMoved( pieceAt( position ) ) && squareEmpty( position + 16 ) && squareEmpty( position + 32 ) ) { destinations.add( position + 32 ); } if ( !squareEmp...
7639e250-eefb-4727-9a14-3313d2b66461
5
public boolean equals(Reaction R){ boolean result = (reactants.length==R.getReactants().length) && (products.length==R.getProducts().length); int i=0; boolean finish=false; while(result && !finish){ if(i<reactants.length){ result = (reactants[i...
32a14ad5-dadf-41c9-8cf9-4885b14a51f4
2
private ArrayList<Chunk> getVillageChunks() { ArrayList<Chunk> villageChunks = new ArrayList<Chunk>(); chunksLock.readLock().lock(); try { for (Chunk c : chunks) { if (c.hasVillage()) { villageChunks.add(c); } } } finally { chunksLock.readLock().unlock(); } return villageChu...
ab11ba49-5a65-41a8-9c67-19a34f27619f
8
public FileStream(RandomAccessFile source) throws OggFormatException, IOException { this.source=source; ArrayList po=new ArrayList(); int pageNumber=0; try { while(true) { po.add(new Long(this.source.getFilePointer())); // skip data if pageNumber>0 ...
1f03b76a-c30f-4edb-a5a7-31a2598342ef
1
public CtField getDeclaredField(String name) throws NotFoundException { CtField f = getDeclaredField2(name); if (f == null) throw new NotFoundException("field: " + name + " in " + getName()); else return f; }
533cbc1e-b18d-4d74-b192-751b8af5ef47
6
private void copyRGBtoBGRA(ByteBuffer buffer, byte[] curLine) { if(transPixel != null) { byte tr = transPixel[1]; byte tg = transPixel[3]; byte tb = transPixel[5]; for(int i=1,n=curLine.length ; i<n ; i+=3) { byte r = curLine[i]; by...
24e41d7f-faab-42bb-ada8-ce064e4d4a4e
8
public String determBacktrack(int start,int end){ String seq=""; int max = this.maxBasepairs[start][end]; if(start == end) return "."; if(start > end) return ""; if(isValidPair(start,end) && this.maxBasepairs[start+1][end-1]+1 == max) return "("+determBacktrack(start+1,end-1)+")"; if(this.maxBasepa...
de959a60-f0cd-4448-b822-b385b4ea232b
7
static final public void expression() throws ParseException { simpleExpr(); switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case EGAL: case DIFF: case INF: case INFEGAL: case SUP: case SUPEGAL: opRel(); simpleExpr(); expression.testRel(); expression.executerOpRel(); ...
4c19284c-b881-4afb-9e71-ef6a7457169d
2
public int cardPosition(Game g, Rack r, int card) { int index = indexer.index(g, r, card); int newPlayState = index; int newPlayAction = playStates[index].getLeastVisited(); if (oldPlayState != -1) { playStates[oldPlayState].updateReward(playStates[newPlayState], oldPlayAction); } oldPlayState = ne...
5522f49f-b642-42cf-aa82-f354c9ef1c2b
5
public String validaFormulario() { String strMsg = ""; if (jrbAdaptativa.isSelected() == false && jrbCorretiva.isSelected() == false && jrbPerfectiva.isSelected() == false) { jrbAdaptativa.setForeground(Color.red); jrbCorretiva.setForeground(Color.red); jrbPerfectiva....
e32e63d1-a204-4de0-b895-405fc7695323
3
public void body() { logger.log(Level.INFO, super.get_name() + " is starting..."); boolean success = sendFailures(); if(success) { Sim_event ev = new Sim_event(); while (Sim_system.running()) { super.sim_get_next(ev); ...
becec958-78a7-4ecc-83f6-71c6b8cd30fd
9
ImportBinding[] getDefaultImports() { // initialize the default imports if necessary... share the default java.lang.* import Binding importBinding = environment.defaultPackage; // if (importBinding != null) // importBinding = ((PackageBinding) importBinding).getTypeOrPackage(JAVA_LANG[1]); // abort if java.lang ca...
4efed489-3233-4ed4-8976-07a9134e8b53
1
public void build() throws Exception { if (build != null) { build.run(); } else { System.err.println(" No build file to run."); } }
07b8eeac-839c-4308-aab6-0ab0b70eca2f
0
public MyButton() { super(); setBorderPainted(false); setFocusPainted(false); addMouseListener(this); }
071cb09a-f4cf-40e3-b954-dcd704159e16
6
@Override public boolean equals(Object obj){ if (obj.getClass() != this.getClass()) { return false; } if (this == obj) { return true; } if (obj == null) { //DEBUG - System.out.println("Object is null"); return false; } //Cast other object to type Contact Contact otherContact = (Contact) obj...
d7af29f3-5fae-4cbc-aa75-4d485a89a6aa
0
public CFDao getCfDao() { return cfDao; }
c1ea9500-703c-45ed-ae35-d7a1d31818ad
9
public void onKeyPressed(int key) { if(key == Input.KEY_A) this.addFacing(new Vector2f(-1.0F, 0)); else if(key == Input.KEY_D) this.addFacing(new Vector2f(1.0F, 0)); else if(key == Input.KEY_W) this.addFacing(new Vector2f(0, -1.0F)); else if(key == Input.KEY_S) this.addFacing(new Vector2f(0, 1.0F))...
289234d7-e862-4a84-83b3-18990e9874a6
9
public void stop() { if (state < 2) return; if (Score.size() < settings.getInt(Setting.MinimumPlayers)) { String message = settings.getString(Setting.FinishMessageNotEnoughPlayers); message = message.replace("<World>", name); Util.Broadcast(message); } else { RewardManager.RewardWinners(this); ...
83f73e14-84c7-4a1a-ab2d-d968d3b8df7f
2
@Override public Set<ServerEndpointConfig> getEndpointConfigs(Set<Class<? extends Endpoint>> scanned) { Set<ServerEndpointConfig> result = new HashSet<>(); if (scanned.contains(UserEndpoint.class)) { result.add(ServerEndpointConfig.Builder.create(UserEndpoint.class, "/socket/listen").build()); result.add(S...
7d6d2a44-5572-4358-a268-a0e5494d1998
8
private void defaultStudent(HSSFRow row, CourseBean course) { HSSFCell cell = null; cell = row.getCell(0); Integer i = null; Long L = null; List<StudentBean> list = course.getStudents(); StudentBean student = new StudentBean(); String first = getCellValue(cell); if (first != null && first.length() > 0)...
a8d87794-7a5f-4ca8-a630-bec0e838bba2
7
public static SequenceIndex selectIsaPropositions(Cons pattern) { { Stella_Object renamed_Object = pattern.rest.rest.value; SequenceIndex index = Logic.unfilteredDependentIsaPropositions(renamed_Object); if (Surrogate.subtypeOfP(Stella_Object.safePrimaryType(index), Logic.SGT_LOGIC_PAGING_INDEX)) { ...
112339ea-f022-4b06-9346-359bf07d3c0b
0
public void setFesCedula(long fesCedula) { this.fesCedula = fesCedula; }
d1ba6a75-40ca-44da-825f-601910501f72
7
public static HandshakeBuilder translateHandshakeHttp( ByteBuffer buf, Role role ) throws InvalidHandshakeException , IncompleteHandshakeException { HandshakeBuilder handshake; String line = readStringLine( buf ); if( line == null ) throw new IncompleteHandshakeException( buf.capacity() + 128 ); String[] f...
cbc3e1f5-9eb0-407b-a324-a84c56c9ced1
7
private String calculate(String x) throws MathParsingException { Matcher m; x = x.replaceAll("[ ]+", " "); // Cas de base : un chiffre if(this.regex(x, "^ [-]?[0-9.]+ $").matches()) return " " + x + " "; // Traitement des log m = this.regex(x, "^(.*)log ([-]?[0-9.]+)(.*)$"); if(m.matche...
6e597c55-1fd9-44c9-8146-38b7b095a397
4
public void rota(){ switch(orientacio){ case NORD: orientacio = Orientacio.EST; break; case EST: orientacio = Orientacio.SUD; break; case SUD: orientacio = Orientacio.OEST; break; ...
8d48f056-e3bb-43aa-bcde-02db9e1a94d1
3
public void init() { // pocet portov a ich hodnoty in.print("* ports : " + ports.size()); ArrayList<Integer> portsz = new ArrayList<Integer>(); for (Integer i : ports) portsz.add(i); long seed = System.nanoTime(); Collections.shuffle(portsz, new Random(seed));...
de39d780-8b5c-4d8d-9098-91049ede9e3f
8
private void writeJSON(Object value) throws JSONException { if (JSONObject.NULL.equals(value)) { write(zipNull, 3); } else if (Boolean.FALSE.equals(value)) { write(zipFalse, 3); } else if (Boolean.TRUE.equals(value)) { write(zipTrue, 3); } else { ...
8bced71d-f762-44e8-a50b-74d8d484324c
8
@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...
2e27810e-854e-4b9e-b60b-ec4cd223d3a7
4
public boolean isNearlyUpperTriagonal(double tolerance){ boolean test = true; for(int i=0; i<this.numberOfRows; i++){ for(int j=0; j<this.numberOfColumns; j++){ if(j<i && Math.abs(this.matrix[i][j])>Math.abs(tolerance))test = false; } } ret...
ab6c8ef2-047d-420b-b96e-76510db8c705
8
static final public void Q2() throws ParseException { switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case MULTIPLY: case DIVIDE: case MODULO: switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case MULTIPLY: jj_consume_token(MULTIPLY); R(); Q2(); break; case DIVIDE: ...
ab443154-8af2-43f1-8794-0c7dcdf3fd1a
8
public long startEvolution(long cycleLimit) { long cycle = 0; boolean finalForm = false; List <E>newList = null; A : while(cycle < cycleLimit && finalForm == false){ int maxFitness = problemSet.getProblems().size(); //calculate fitness values for(E c : candidates){ //c.checkViabilityAndReset...
88baa347-2a25-4e3e-b504-783122fccf0e
4
@Override public Object execute(HttpServletRequest request, HttpServletResponse response) throws Exception { Contexto oContexto = (Contexto) request.getAttribute("contexto"); switch (oContexto.getSearchingFor()) { case "hilo": { oContexto.setVista("jsp/hilo/list.jsp"); ...
64216ed2-8986-4aec-963c-0ca0376f8832
7
private void flipColors(IntervalNode h) { // h must have opposite color of its two children assert (h != null) && (h.left != null) && (h.right != null); assert (!isRed(h) && isRed(h.left) && isRed(h.right)) || (isRed(h) && !isRed(h.left) && !isRed(h.right)); h.color = !h.color; h.left.color = !h.left.colo...
374792b0-107e-4163-8fbf-a89fdb5974da
2
private void buildSpecialTrees(final Map catchBodies, final Map labelPos) { Tree tree; tree = new Tree(srcBlock, new OperandStack()); srcBlock.setTree(tree); tree = new Tree(snkBlock, new OperandStack()); snkBlock.setTree(tree); tree = new Tree(iniBlock, new OperandStack()); iniBlock.setTree(tree); ...
b994da9e-fc2f-4c19-bce0-95d7c28cc62b
5
private void permuteImp(ArrayList<ArrayList<Integer>> res, ArrayList<Integer> tmp, int[] num, boolean[] visited) { //if all checked, return if (tmp.size() == num.length) { res.add(new ArrayList<Integer>(tmp)); return; } for (int i = 0; i < num.length; i++) { ...
f14e16ca-1dd6-4d13-b6a8-51d4532e9fae
1
public static boolean areMoreVariablesThatBelongInUsefulVariableSet( Grammar grammar, Set set) { if (getVariableThatBelongsInUsefulVariableSet(grammar, set) == null) return false; return true; }
b913fb80-2bf6-4c76-a21b-3b41790e6616
4
@Override public void execute(VGDLSprite sprite1, VGDLSprite sprite2, Game game) { ArrayList<Integer> subtypes = game.getSubTypes(itype); for (Integer i: subtypes) { Iterator<VGDLSprite> spriteIt = game.getSpriteGroup(i); if (spriteIt != null) while (spriteIt.hasNext()) ...
802bf101-3ba1-4a52-9ab2-8f9dba866162
2
public void paint(Graphics g){ //g.drawImage(this.bodypart.getIcon(), 0, 0, null); g.drawString(this.bodypart.getName(), 8, 18); g.setColor(Color.ORANGE); Upgrade[] upgrades = this.bodypart.getUpgrades(); for(int i = 0; i < upgrades.length; i++){ if(upgrades[i] == null) continue; g.drawString(upgrades[i...
fb99f732-dc4b-4b07-a314-c756e12475c3
1
public int deleteBook(String bookID) { try { // Erforderlicher SQL-Befehl String sqlStatement = "DELETE FROM bookworm_database.books WHERE id = " + bookID + ";"; // SQL-Befehl wird ausgeführt successful = mySQLDatabase.executeSQLUpdate(sqlStatement); return successful; } catch (Exception e) ...
22da4070-748e-4107-83c8-065a7a8f183b
0
protected void initialize() { _timer.start(); }
70d2259b-f82a-456f-ba20-a0f2d18171b0
3
public Ul(HtmlMidNode parent, HtmlAttributeToken[] attrs){ super(parent, attrs); for(HtmlAttributeToken attr:attrs){ String v = attr.getAttrValue(); switch(attr.getAttrName()){ case "compact": compact = Compact.parse(this, v); break; case "type": type = Type.parse(this, v); break;...
c67ac29e-7a01-4c52-974f-3bfcd43d21af
9
public int getClueNumber(int x, int y) { int foundMines = 0; for(int j = y - 1; j <= y + 1; j++) { for(int i = x - 1; i <= x + 1; i++) { if(j == y && i == x) { continue; } else if(j < 0 || i < 0 || !(j < mineFieldGrid.length) || !(i < mineFieldGrid[j].length)) { continue; } else { ...
a7ab76f5-d9ce-412f-a274-cefa0b349bd5
8
public static String stripEnd(String str, String stripChars) { int end; if (str == null || (end = str.length()) == 0) { return str; } if (stripChars == null) { while (end != 0 && Character.isWhitespace(str.charAt(end - 1))) { end--; } } else if (stripChars.length() == 0) { return str; } els...
5c0ddf4d-a662-4173-b327-5458852e440a
3
public String fourthFieldTrans(String field, int min, int max) { String newField = ""; System.out.println("test"); if(field.substring(0, 1).equals("*")) { newField = "EVERY"; } else if(field.length() > 1) { if(!isWeekLetter(field.substr...
6521029d-5cf4-40c6-8a39-e6c6c5c019ec
4
public Chunk(World w, int x, int y, int z) { data = new boolean[chunkW * chunkH * chunkD]; chunkX = x; chunkY = y; chunkZ = z; for (int xx = 0; xx < chunkW; xx++) { for (int yy = 0; yy < chunkH; yy++) { for (int zz = 0; zz < chunkD; zz++) { if(noiseGen(((float)xx + (float)chunkX), ((float)yy + (fl...
c44eaf43-8f0d-460f-a4f7-d90d7025835f
3
public Scan(String args[]) { // the constructor // open an input file if one specified on command line. // o.w., use standard input. try { if (args.length == 0) { InputStreamReader isr = new InputStreamReader(System.in); br = new BufferedReader(isr); ...