method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
5bbf2020-b42f-4fb8-bd66-f601d2b5ef44
8
private void conectBotonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_conectBotonActionPerformed if(userTF.getText().equals("") && passTF.getText().equals("") && ipTF.getText().equals("") && portTF.getText().equals("") && dbTF.getText().equals("")) { JOptionP...
68ce029c-6e39-41f3-922a-b418ff2d8cef
6
public void deleteIssueFired(ActionEvent event) { final String selectedProject = getSelectedProject(); if (model != null && selectedProject != null && table != null) { // We create a copy of the current selection: we can't delete // issue while looping over the live selection,...
e0b72cfc-ace5-46e0-b677-e0fe3eff12fa
7
public static String getLocationData() { HttpURLConnection urlConnection = null; BufferedReader reader = null; String geoip = null; final String GEO_IP = "http://www.telize.com/geoip"; try { URL url = new URL(GEO_IP); urlConnection = (HttpURLConnection)...
6fb3666e-c2c2-4553-89f3-e690b9a8ea10
5
private void refreshScriptActions() { Iterator<String> it = vetScript.iterator(); // Skip "serialNumber". if (it.hasNext()) { it.next(); } // Get number of actions and discovers how many digits it has. int total = vetScript.size(); int nDigits = 0; while (total > 0) { total = total / 10; nDig...
72138530-d80e-4d7f-811d-5e74c401c9b9
7
@Override public void caseAIdxAcsStmt(AIdxAcsStmt node) { inAIdxAcsStmt(node); if(node.getSmc() != null) { node.getSmc().apply(this); } if(node.getAssgn() != null) { node.getAssgn().apply(this); } if(node.getEq() != null) ...
63c042da-4790-4d23-acdc-253e73058d71
8
@Override protected void map(LongWritable key, Text value, Context context) throws IOException, InterruptedException { Boolean has_retweet = true; JSONObject json; try { json = (JSONObject) parser.parse(value.toString()); String time = Utility.convertDateFormat(json.get("created_at").toString())...
c637221c-f76f-4c96-8718-21b92950aaaa
9
public void setFakeResult(){ /* * 村人騙りなら不必要 */ if(fakeRole == Role.villager){ return; } //偽占い(or霊能)の候補.以下,偽占い候補 List<Agent> fakeGiftTargetCandidateList = new ArrayList<>(); List<Agent> aliveAgentList = getLatestDayGameInfo().getAliveAgentList(); aliveAgentList.remove(getMe()); for(Agent agen...
62d80d62-34f5-4846-8dc9-a5eb460980f5
4
@Override public void paint(Graphics g) { try { ImageIcon img = null; if ("".equals(modal)) { img = new ImageIcon(this.getClass().getResource( "/images/" + name + ".png")); } else { img = new ImageIcon(this.getClass().getResource( "/images/" + name + "_" + modal + ".png")); } if (i...
e80ec315-96f2-4c41-94fb-7ec7d1904573
4
public Sentiment[] getSentiment ( String text ) { // System.out.println(text); text = cleanText(text); // System.out.println(text); Sentiment[] result = new Sentiment[text.split("\\.").length]; int i = 0; int count = 0; int tense = 0; Double score = 0.0; ...
2a7d6c0f-8e27-4e79-a537-ff200a7bfa6b
2
public int compare(SimNode o1, SimNode o2) { // TODO Auto-generated method stub double numbera = o1.getSim(); double numberb = o2.getSim(); if(numberb > numbera) { return 1; } else if(numberb<numbera) { return -1; } else { return 0; } }
66c4f9af-b758-4145-bdbe-54fafd875fa2
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 DatasetUpdateFrequency)) { return false; } DatasetUpdateFrequency other = (DatasetUpdateFrequency) object; if (...
5e26ef00-ede3-4ce4-99c8-fa86858df34a
2
public KeyInfo load(String password) throws CertificateException, IOException, KeyStoreException, NoSuchAlgorithmException { FileInputStream fin = null; try { char[] psw = password.toCharArray(); String alias = ""; this.keyInfo = null; fin = n...
b4014b43-44fd-4ffc-be39-9f7eb4369093
8
public Range getHelix(int index) { if((index<0)||(index>=_str.length)) { return new Range(index,index);} int j = _str[index]; if(j!=-1) { int minH = index; int maxH = index; if (j>index) { maxH = j; } else { minH = j; } boolean over = false; while (!over) { if((...
67702c6e-23be-4ab2-99f6-44abbbf74a3d
5
public void setUser(User newUser) { if (newUser == null || (user != null && newUser.getID().equals(user.getID()))) return; if ( (newUser.lastLog == null) || (System.currentTimeMillis() - newUser.lastLog.getTime()) > 600_000) { // if lastlog is older then 10 min or first login newUser.logins++; }...
b1c20e55-4939-4b91-87cd-3745e9bd7937
4
@Override public int hashCode() { int result = alpha != null ? alpha.hashCode() : 0; result = 31 * result + (red != null ? red.hashCode() : 0); result = 31 * result + (green != null ? green.hashCode() : 0); result = 31 * result + (blue != null ? blue.hashCode() : 0); return r...
b963743f-472c-4c48-9d88-490e502f1a6e
4
@Override public void encode(final ByteBuffer buf, final StringBuilder log) { encoder.encode(buf, log); final byte tick_time = (byte) 10; final byte ticks = (byte) 240; buf.put(tick_time); buf.put(ticks); final short body_size = (short) body.getRequestSize(); ...
072ad0cd-fe6f-413d-8003-219f2efa3f74
2
public boolean instanceOf(Object obj, String className) throws InterpreterException { Class clazz; try { clazz = Class.forName(className); } catch (ClassNotFoundException ex) { throw new InterpreterException("Class " + ex.getMessage() + " not found"); } return obj != null && !clazz.isInstance(ob...
62e07bc6-d44f-4d32-9bb4-161025e787c7
6
private void setVotableResource(final DataSetApplication datasetApp, final SimpleSpectralAccessInputParameters inputParameters, final ResourceModel model, final String dictionaryName) { final List<Field> fieldList = new ArrayList<Field>(); final List<String> columnList = new ArrayList<String>(); ...
e398df25-b049-4aed-b8ff-1c768824fa7a
1
public static void leastPaidEmployees(EntityManager entityManager) { TypedQuery<Employee> query = entityManager.createQuery( "select e from Employee e order by e.salary asc", Employee.class); query.setMaxResults(2); List<Employee> resultList = query.getResultList(); entityManager.close(); for (E...
80962267-8382-4027-b55e-70c9f0b82c67
1
public void refuel(int fuel) { tank.refuel(fuel); if(!tank.isEmpty()) { setDead(false); } }
e736e8e2-2476-4ef1-8da5-3bfa8adc4bd0
1
public Expr pop1() { final Expr top = (Expr) stack.remove(stack.size() - 1); final Type type = top.type(); if (type.isWide()) { throw new IllegalArgumentException("Expected a word " + ", got a long"); } height--; return top; }
e79aa93a-15c2-41a3-9d3a-519eef2919e4
2
public static void winLose(){ if (Empous.Gov.getStat("publicopinion")>100){ UpdateView finalUpdate = new UpdateView(0); finalUpdate.display(); System.out.println("YOU'RE WINNER!"); } else if (Empous.Gov.getStat("publicopinion")==0){ UpdateView finalUpdate = new UpdateView(0); finalUpdate.display();...
ba21b380-676d-47a2-ab2c-d55c1e4ab529
5
public Point getTileCollision(Sprite sprite, float newX, float newY) { float fromX = Math.min(sprite.getX(), newX); float fromY = Math.min(sprite.getY(), newY); float toX = Math.max(sprite.getX(), newX); float toY = Math.max(sprite.getY(), newY); // get the tile loca...
44955909-0d7c-4592-aacf-43f88dab7a05
7
public void step() { if( !ready && source.ready ) { init(); } if( !run || !ready ) return; if( actions!=null && frame<actions.length ) if( actions[frame]!=null ) actions[frame].exec(this); frame=(frame+1)%size; }
42aa13fe-91b5-464f-ada7-652fc0f2f3de
1
public Builder mass(double receivedMass) { if (receivedMass < 0) { log.warn("Wrong Mass. receivedMass =", receivedMass); throw new IllegalArgumentException("Mass must be > 0 Received value =" + receivedMass); } this.mass = receivedMass; ret...
8b3eb99a-e5f3-4502-b3b6-0fa78f67e47f
8
public /*@non_null@*/ int [] getSelection() { if (m_Upper == -1) { throw new RuntimeException("No upper limit has been specified for range"); } int [] selectIndices = new int [m_Upper + 1]; int numSelected = 0; if (m_Invert) { for (int i = 0; i <= m_Upper; i++) { if (!m_SelectFlags...
2e48c8ff-ea1e-40ad-a50f-23b8e98c2676
8
@Override public int lookup(String key){ if (key == null || key.isEmpty()) return UNKNOWN_ID; CodeSequence cs = thl.get(); cs.set(key, codemap_); int src = ROOT ; int pos = 0 ; while (pos < cs.size_){ int dest = Node.BASE(nodes_[src]) + cs.s...
155c7381-832b-402d-9d46-fc46005e624c
8
final boolean method1158() { if (anIntArray2085 == null) { return anInt2065 != -1 || anInt2101 != -1 || anInt2098 != -1; } for (int i = 0; i < anIntArray2085.length; i++) { if (anIntArray2085[i] != -1) { NPCComposite NPCComposite = Class21.npcCompositeForI...
983bf5cc-3700-405a-ac77-285313590c93
0
public static void main(String[] args) { System.out.println(1 + 2 * 3); // 7 System.out.println((1 + 2) * 3); // 9 System.out.println(1 + (2 * 3)); // 7 }
f239893a-8d41-4269-9d1b-615b1f460620
7
public int getBlockId(int par1, int par2, int par3) { if (par2 < 0) { return 0; } else if (par2 >= 256) { return 0; } else { int var4 = (par1 >> 4) - this.chunkX; int var5 = (par3 >> 4) - this.chunkZ; ...
e8eb909a-3807-4432-9d2e-ddfa6e5cb9b0
8
@Override public void actionPerformed(ActionEvent e) { if (e.getSource().equals(mat)) { String selected = mat.getText(); Materie materie_noua = null; for (Materie m : Centralizator.getInstance().getMaterii()) { if (m.getNume().equals(selected)) { materie_noua = m; return; } } if (ma...
c4cd7528-198e-4b8f-908f-a2f7f3f4ddca
7
protected void processConnection(StreamConnection connection) { LOGGER.entry(connection); if (stopRequested) { LOGGER.exit(); return; } DataInputStream dis; try { dis = connection.openDataInputStream(); } catch (IOException e) { LOGGER.catching(e); LOGGER.exit(); return; } boolean c...
7ee94dab-1dad-45e6-bdd4-4913455725c0
2
private float blink(float alpha){ this.alpha += this.velocity; if(this.alpha > 255 || this.alpha < 0){ this.velocity = -this.velocity; } return this.alpha; }
1dfbf384-8fb1-43bb-964f-373c05d25608
3
public long seek(long offset, int seekOrigin) throws java.io.IOException { if (bufferSize > 0) { stream.write(buf.array(), 0, bufferSize); buf.clear(); bufferSize = 0; } if (seekOrigin == STREAM_SEEK_SET) { stream.seek(offset); } else if (s...
7ceccb36-2a5b-468c-8bd8-26a6e2b5012a
6
public static boolean updateAvailable() throws Exception { String version = plugin.getDescription().getVersion(); URL url = new URL("http://api.bukget.org/api2/bukkit/plugin/everlastingweather/latest"); InputStreamReader isr; try { isr = new InputStreamReader(url.openStream()...
5b5394da-edea-41ac-9b1c-68e72640287c
6
public static KeyValueList collectForwardChainingRules(Description description, Object [] MV_returnarray) { { MemoizationTable memoTable000 = null; Cons memoizedEntry000 = null; Stella_Object memoizedValue000 = null; if (Stella.$MEMOIZATION_ENABLEDp$) { memoTable000 = ((MemoizationTable)(...
5a5be80b-a431-46a7-b560-cf1a796e5a95
0
protected void end() { Robot.driveTrain.tankDrive(0, 0); }
2f8a7141-1510-43e2-8a15-721f08b8f21b
4
protected synchronized void processEvent(Sim_event ev) { /***** NOTE: debugging information System.out.println(super.get_name() + ".processEvent(): Event was scheduled for " + ev.event_time()); System.out.println(super.get_name() + ".processEvent(): ev.get_tag() is " + ev.g...
c5eaa29e-26f3-473f-b36e-4ef0470de892
5
private static void printNode(NodeList nodeList) { for (int count = 0; count < nodeList.getLength(); count++) { Node tempNode = nodeList.item(count); // make sure it's element node. if (tempNode.getNodeType() == Node.ELEMENT_NODE) { // get node name and valu...
848bc640-0152-414f-9948-d42d1cebcfa6
5
public JSONObject toJSONObject(String languagecode, String p) { JSONObject jresult = new JSONObject(); if (p.equals("*")) { JSONArray ar = new JSONArray(); jresult.put("properties", ar); for(Iterator<String> i = this.getKeys(); i.hasNext();){ JSONObject n = new JSONObject(); String key = i.next(); ...
1b3bda29-f5e1-4d9d-8de0-f881b841df44
7
static private Point[] dodecahedron() { Point[] ret = new Point[20]; final double GOLDEN = (1 + sqrt(5)) / 2; int i = 0; for (int x = -1; x <= +1; x++) { for (int y = -1; y <= +1; y++) { for (int z = -1; z <= +1; z++) { if (x * y * z != 0) ...
fed6c163-b925-4ab0-bb17-2fcaf5901cb4
5
@Override public synchronized void unRegisterClient(Trader trader) throws RemoteException, RejectedException { if (!this.registeredTraders.contains(trader)) throw new TraderNotExistsException(trader); for (Item it : this.itemsOnSale) { if (it.getOwner().equals(trader)) { this.itemsOnSale.remove(it); ...
c92b3cd1-9cdd-4ee1-a310-1a73d12c4d76
8
public void extractor() throws UnknownHostException, InterruptedException { int c = 0; conf.init(); while (true) { double lastProcessTime = 0; DB db = Mongo.connect(new DBAddress(conf.getSourceHost(), conf.getSourceMongoDBName())); DB proDb = Mongo.connect(new...
2ab27318-b1b2-4298-ac30-6e742c6c486b
4
@Override public void run() { try { report ("saving started", 1); //note: this iterator does not require locking because of CopyOnWriteArrayList implementation for (AbstractPage child: page.childPages) jobMaster.submit(new SaveDataJob(child,jobMaster)); if (!page.saveResult(this)) report("...
956fb118-d8e3-4dc1-840d-d39e4e52f2b5
7
private void executeDockCommand(String[] commandString, Player player) throws CommandException { if (DockCommand.isDockCommand(commandString[0])) { DockCommand firstCommand = DockCommand.toCommand(commandString[0]); switch (firstCommand) { case UNDOCK: undock(...
f0aa55a1-ca82-4806-aff2-1284c556412c
6
public void setEnabled(boolean enabled) { if (!m_enabled && enabled) { // if the state changed to enable then add the stored handlers // copy the stored handlers into a new list to avoid concurred access to the list List<ClickHandler> handlers = new ArrayList<ClickHandler>(m...
1e6ea2a9-0b7b-4279-8beb-6311d95549c2
7
public static void main(String[] args) { try { for (UIManager.LookAndFeelInfo info : UIManager.getInstalledLookAndFeels()) { if ("Nimbus".equals(info.getName())) { UIManager.setLookAndFeel(info.getClassName()); break; } ...
693da1ec-ff8d-4277-9187-f568491a7c8b
0
public Player returnPlayer(){ return storage; }
40db93f7-58bc-4772-a07c-69ab0b138852
5
public String getUsername() { String username = ""; if (type == 0 || type == 1) { if (menuComponents != null) { if (menuComponents.get(0) != null) { try { username = ((MenuTextBoxV2) menuComponents.get(0)) .getSubmitted(); } catch (Exception e) { } } } } return usern...
c773d748-b48c-49ab-a44e-df03f8bdc59f
7
public void update(double theta) { // position.x += theta * direction.x; obstacle.position.y += theta * velocity.y; if (obstacle.position.y > Main.game.player.main.position.y - 2 * Main.game.player.main.size && obstacle.position.y < Main.game.player.main.position.y + 2 *...
46c3de75-9a2c-424d-a918-c1629c7ceb13
5
public static String pformat(Collection<?> c){ if(c.size() == 0) return "[]"; StringBuilder result = new StringBuilder("["); for(Object elem : c){ if(c.size() != 1) result.append("\n "); result.append(elem); } if(c.size() != 1) result.append("\n"); result.append("]"); return result.toStri...
dac8d982-e108-4918-83c0-22af05b2c153
8
private int checkBox(GameBoardMark playerMark) { for (int k = 1; k < 8; k++) { for (int l = 1; l < 8; l++) { int cnt = 0; int pos = -1; for (int a = 0; a < 2; a++) { for (int b = 0; b < 2; b++) { int x = k + ...
76f60e33-a199-4afc-92f6-5719d43be740
5
private void drawObjects(Graphics g) { if (craft.isVisible()) { g.drawImage(craft.getImage(), craft.getX(), craft.getY(), this); } ArrayList<Missile> alMissiles = craft.getMissiles(); for (Missile m : alMissiles) { if (m.isVisible()) { ...
3d9fb3a7-01d1-47c0-b56e-6a605924dfd9
2
public static void main(String [] args) throws SQLException { DataInitialization thing = new DataInitialization(); if (args[0].equals("destroy")) { thing.destroyData(); } else if (args[0].equals("init")) { thing.initialData(); } }
03115389-a31a-45dc-bc7f-b4b857735b7e
9
public void writeUTF(String s) throws IOException { int numchars = s.length(); int numbytes = 0; for (int i = 0; i < numchars; i++) { int c = s.charAt(i); if ((c >= 0x0001) && (c <= 0x007F)) ...
44433703-83ab-41fc-98c6-8866d13c19a9
4
public static DCPackage getPackage(byte[] raw) throws InputMismatchException{ if(raw.length != PACKAGE_SIZE) { throw new InputMismatchException("The size of the raw byte input is " + raw.length+" and does not match the expected package size " + PACKAGE_SIZE); } else { byte number = raw[0]; if(number < 0 ||...
43e475df-2618-4aad-a0ef-a2260ccc897a
2
public void process(float newSpeed, double newLatitude, double newLongitude, long newTimeStamp, float newAccuracy) { // Uncomment this, if you are receiving accuracy from your gps // if (newAccuracy < Constants.MIN_ACCURACY) { // newAccuracy = Constants.MIN_ACCURACY; // } if...
309d0369-09bb-40ce-af90-98d505c3d150
9
public boolean copy(String frompath, long every, URI tofttppath){//every 8m /*System.out.println("tofttppath:"+tofttppath); System.out.println("this.host:"+this.host); System.out.println("this.port:"+this.port); System.out.println("tofttppath.getHost:"+tofttppath.getHost()); System.out.println("tofttppath.get...
07cf4f42-ce83-4458-8e3d-eb0ae9322829
9
@Override public Object visitExpression(ExpressionContext ctx, CalcScope scope) { setCurrentScope(scope); CalcValue value = new CalcValue(); value.setType(int.class); if (ctx.getChildCount() == 1) { if (ctx.integerLiteral() instanceof CalcParser.IntegerLiteralContext) { value.setValue(visitIntegerLitera...
a94ce08b-8a3c-420a-a042-8daa21eb1fe3
7
@Override public boolean invoke(MOB mob, List<String> commands, Physical givenTarget, boolean auto, int asLevel) { if(!super.invoke(mob,commands,givenTarget,auto,asLevel)) return false; final boolean success=proficiencyCheck(mob,0,auto); if(success) { invoker=mob; final CMMsg msg=CMClass.getMsg(mob,...
6cb13d38-df51-4b07-a8c4-0e1ccf90d632
0
public Worker () { //initial settings isInputActive = true; this.keyboard = new BufferedReader(new InputStreamReader(System.in)); students = new HashMap<String, Student>(); System.out.println(MSG_WELCOME); //start this.lifeCycle(); }
55672683-e6d9-4be8-b061-21ed93e11191
3
private void getCurrentSettings() { System.out.println("SW| start getCurSets"); mySets = new Settings(); try { FileInputStream fs = new FileInputStream("settings.txt"); ObjectInputStream os = new ObjectInputStream(fs); Object obj = os.readObject(); ...
c759fbfc-2061-4f84-b431-21eeb7a1aa77
1
public VideoStore() throws Exception { try{ String username = "cs5530u33"; String password = "mdtiepn5"; String url = "jdbc:mysql://georgia.eng.utah.edu/cs5530db33"; Class.forName ("com.mysql.jdbc.Driver").newInstance (); connection = DriverManager.getConnection (url, username, password); /*//Drive...
a875d704-1a2c-464b-bd72-31591f0d5f1c
4
public int itc(Model model){ int res = 0; for(Operation op : this.getArrayOperation()){ for(Argument arg : op.getArg()){ for(Classe c : model.getClasse()){ if(arg.getType().trim().equals(c.getIdentifier().trim())){ res++; } } } } //System.out.println("La Classe " + this.identifier ...
c834f2c3-c141-4dad-b996-0f2bbfd5fd0f
5
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { String xquery = "<xml>{ for $cedar in collection('CED2AR') return "; String[] query = request.getParameter("query").split(" "); for(int i = 0; i < query.length; i++){ if(i == 0){ xquery +...
13c818ab-a786-4a7a-9659-dbbf206b7392
0
public boolean isVisible(int row, int col){ return (visited[row][col] == RoomState.VISITED); }
63bed32c-cad4-4c73-9ba1-21203dae3f09
9
static void lsp_to_curve(float[] curve, int[] map, int n, int ln, float[] lsp, int m, float amp, float ampoffset){ int i; float wdel=M_PI/ln; for(i=0; i<m; i++) lsp[i]=Lookup.coslook(lsp[i]); int m2=(m/2)*2; i=0; while(i<n){ int k=map[i]; float p=.7071067812f; floa...
92f9a604-4737-46f1-bedb-62cb914bbf59
1
public CashOffice registerCashOffice(CashOffice cashOffice) { int index = cashOffices.indexOf(cashOffice); if (index == -1) { addCashOffice(cashOffice); return cashOffice; } else { CashOffice foundedCashOffice = cashOffices.get(index); // Iterator<Ticket> tickets = cashOffice.ti...
7b946485-9120-467e-b488-689350a2d400
4
@Test public void testDir() { Path dir = Paths.get("F:\\\\tmp"); //这个只能列出当前目录下符合的文件 try (DirectoryStream<Path> stream = Files.newDirectoryStream(dir, "*.txt")) { System.out.println("=========DirectoryStream start========="); for (Path path : stream) { System.out.println(path); } System.ou...
3490265d-7d43-4926-a25e-b256785f2822
5
GUI() { super("Michelizer (" + Resources.VERSION_NUMBER + " - " + Resources.VERSION_CODENAME + ") - The All-In-One ECE 460 Solver"); FlowLayout fl = new FlowLayout(); fl.setAlignment(FlowLayout.LEFT); setLayout(fl); createPane1(); createPane2(); createPane3(); createPane4(); createPane5(); creat...
5d60b774-d1d0-41c6-9b38-50935728eac0
6
public Header readFrame() throws BitstreamException { Header result = null; try { result = readNextFrame(); // E.B, Parse VBR (if any) first frame. if (firstframe == true) { result.parseVBR(frame_bytes); firstframe = false; } } catch (BitstreamException ex) { if ((ex.getErrorCo...
8891d13b-edf7-4b15-b2bd-c34b992bfd4c
8
public static void main(String[] args) { Connection conn = null; PreparedStatement pstat = null; ResultSet rs = null; try { Class.forName("org.h2.Driver"); /** * jdbc:h2:tcp://<server>[:<port>]/[<path>]<databaseName> * jdbc:h2:tcp://localhost/~/test * jdbc:h2:tcp://dbserv:8084/~/sample * j...
6bc597a2-6dd6-4c49-9d38-f3f84a5dc90b
5
public static MaplePacket showAllianceMembers(MapleCharacter chr) { MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter(); mplew.writeShort(SendPacketOpcode.ALLIANCE_OPERATION); mplew.write(0x0D); MapleAlliance az = chr.getGuild().getAlliance(chr.getClient()); int e = 0; for (int u = 0; u < 5;...
0332a55c-be55-4dac-9385-d25fd04db793
7
public void createDatabase() { try { Class.forName("com.mysql.jdbc.Driver"); //String url = "jdbc:mysql://127.0.0.1/interactive_house?user=root&password="; Connection con = DriverManager.getConnection("jdbc:mysql://127.0.0.1/?user=root&password=root"); ResultSet r...
d36c35e2-2647-4441-be72-2cd859e9f930
9
public Vector2 getCollisionPoint(Segment2D other) { Vector2 p = getIntersectionPoint(other); if (p == null) return null; if ((p.x >= start.x && p.x <= end.x) || (p.x >= end.x && p.x <= start.x)) { if ((p.y >= start.y && p.y <= end.y) || (p.y >= end.y && p.y <= start.y)) return p; } return null; ...
21b24034-4585-4146-b788-6c925f89cdf7
4
public void start(Stage primaryStage) throws IOException, URISyntaxException { musicList = new ArrayList<>(); File musicFile = new File("src/gameMusic"); System.out.println("\"src/gameMusic\" exists?; " + musicFile.exists()); String file = "file:///" + musicFile.getAbsolutePath().replace('\\', '/'); ...
88232016-0617-449f-9baa-e86b1975a1ce
1
public static void main(String[] args) { Man[] myarray = new Man[4]; myarray[0] = new Employee("Mykola", "Myronov"); myarray[1] = new Employee("Evgen", "Mazek"); myarray[2] = new Employee("Олег", "Спека"); myarray[3] = new Employee("Олег", "Спека"); for (Man variant : myarray){ System.out.println(vari...
49d7d2ef-400c-4f06-a9fa-20fc82708975
0
@Test public void testGetContent() throws Exception { new BibleContentTw().getContent(); }
769be7df-3e9b-4e63-aeb3-84f915eb1687
0
public String echo(String message) { return "hello: " + message; }
e1686a4e-0c33-4bd8-96b2-3b9b8ce32f1c
5
private Node getLowestFNode() { Node out = null; synchronized (OPENLIST) { for (Node n : OPENLIST) { if (out == null) out = n; else { if (n.F < out.F) out = n; } } } if (details && out != null) System.out.println("Lowest F Node: ("+out.x+","+out.y+")"); return out; }
b950c36b-b9a8-462b-a137-e7d122457c29
6
public static Moves getRemainingExpansionMoves(BotState state) { Moves out = new Moves(); List<Region> borderRegions = state.getVisibleMap().getBorderRegions(state); List<Region> valuableExpansionRegions = new ArrayList<>(); for (Region borderRegion : borderRegions) { if (isExpandingValuable(state, borderReg...
3f049bc3-c0e2-4e50-95ed-cf3c946677bd
6
private static JsonObject parseObj(Buffer<Token> buf) throws JsonParseException { Token tkn = buf.next(); if (!"{".equalsIgnoreCase(tkn.str)) { throw new JsonParseException("Found \"%s\" at line %s, col %s; Was expecting \"{\"", tkn.str, tkn.line, tkn.col); } JsonObject ret = new JsonObject(); boo...
5fb702d0-1292-4b2e-bf14-8c209f1b7096
9
public boolean twoOpt(){ int pathLength=tour.length(); int k=Math.min(160, pathLength); int progress=0; boolean better=false; outer: for(int currentVerticeIndex=0; currentVerticeIndex<pathLength;currentVerticeIndex++){ // for(int currentVerticeIndex=0; progress<pathLength; progress++){ // currentVert...
992318ca-9e9a-4047-b644-89aec9413a80
0
public void setjLabelNom(JLabel jLabelNom) { this.jLabelNom = jLabelNom; }
ba90ce75-7253-49d6-8322-5519f3760f02
3
public void idle(){ if (!armChannel.getAnimationName().equals("ArmIdle") && !hasSwung){ armChannel.setAnim("ArmIdle"); } if (!legChannel.getAnimationName().equals("LegsIdle")){ legChannel.setAnim("LegsIdle"); } }
6438361d-0405-491d-bd2a-b69fa8adcf0e
1
private void resize(int capacity) { assert capacity >= N; Key k[] = (Key[]) new Comparable[capacity]; Value v[] = (Value[]) new Object[capacity]; System.arraycopy(keys, 0, k, 0, (keys.length < k.length) ? keys.length : k.length); keys = k; System.arraycopy(vals, 0, v, 0, vals.length); vals = v; }
bf3044e4-4002-447a-b803-8ecf82a68db6
7
public boolean deleteReminder(String pid,int alertType){ logger.error("Deleting the patient with patient id:"+pid+" for alert:"+alertType); boolean deletePatient=false;PAlert patientAlert=null; Patient patient=getPatient(pid); List list=getpatientAlert(pid,alertType); if(list!=null && list.size()>0) patien...
530d7aaf-44d1-4668-b716-f8877b2780a4
7
private Response takeAnswer() throws IOException{ //Implementation to take answer input. Used for storing user responses and storing answer keys. String s; HashMap<String, ArrayList<String>> dictAns = new HashMap<String, ArrayList<String>>(); //HashMap to pass to Response for (int i=0; i < getLeft().size(); i+...
18384227-ed76-4760-85e2-3e564ef9ad88
1
public static int getTypeSize(String typeSig) { return usingTwoSlots(typeSig.charAt(0)) ? 2 : 1; }
d472d805-f3cb-41e5-8e59-5c2198561af1
8
private static <T> T attemptLoad( final Class<T> ofClass, final String className) { if (LOG.isLoggable(Level.FINEST)) { LOG.finest("Attempting service load: " + className); } Level level; Throwable thrown; try { Class<?> clazz = Cla...
c7d2d8ff-ef42-4be6-8d8b-ada7399fbd4b
2
public String doValidate(Number value) { long l = value.longValue(); if (l > max) return "Is larger than " + max; if (l < min) return "Is smaller than " + min; return null; }
d379bb0d-ce86-4013-8090-6106b9bad5ab
5
public static void loadConstants() { try { //get a connection to the constants file and read it final String fileName = "file:///" + CONSTANTS_FILE_NAME; printIfDebug("Opening constants file: " + fileName); FileConnection commandFileConnection = (FileConnection) C...
a3f058a7-a638-4644-b1e8-de78068a029a
8
public int[] searchRange(int[] A, int target) { // Start typing your Java solution below // DO NOT write main() function if (A.length == 0) { return new int[] { -1, -1 }; } int[] range = new int[2]; int start = 0; int end = A.length - 1; int mid; int left = -1; int right = -1; while (start <=...
730db8fc-fc6c-4351-b520-77f123dc1d02
4
@Override public String toString() { StringBuilder sb = new StringBuilder(); for (int y = 0; y < boardSize; ++y) { for (int x = 0; x < boardSize; ++x) { String player = " "; if (intersections[x][y] == PLAYER_1) { player = "X"; } else if (intersections[x][y] == PLAYER_2) { player = "O"; ...
3c091a29-b0b0-4baa-a899-00cba7cfc992
4
@Override protected void balancing() { super.balancing(); if (this.balance() == 2) { if (this.getRight().balance() >= 0) this.leftRotation(); else { this.getRight().rightRotation(); this.leftRotation(); } } else if (this.balance() == -2) { if (this.getLeft()...
98681c81-30d8-4960-ae2d-6f6e7d43c789
4
public Term negate() { Term[] t=new Term[sub.length]; boolean w=true; for(int i=0;i<t.length;i++) { if(w&&sub[i].isNegative()) { w=false; t[i]=sub[i].negate(); } else { t[i]=sub[i]; } } ...
3bae5192-9852-4d33-9532-b4c10cfa3de6
5
@Override public void extract() throws XMLStreamException, FileNotFoundException { FileInfo ulic = this.bfis.get(Parser.Types.ULIC.toString()); this.factory = XMLInputFactory.newInstance(); this.readerRaw = factory.createXMLStreamReader(new BufferedInputStream(new FileInputStream(...
e38f4d0b-6be8-4591-8f23-b999f729fa37
6
public void choixActionBraquage() { int choix = 0; boolean recommencer = true; System.out.println("Que voulez-vous faire ?" + "\nVous avez le choix entre vous cacher (tapez 1) ou vous interposer (tapez 2)"); do{ try{ choi...
32049e82-e1d8-4703-a96d-c4ff14c0e053
9
private void buildAmineDiConjunctiveSuffix(List<Element> words) throws StructureBuildingException { for (Element word : words) { if (!WordType.full.toString().equals(word.getAttributeValue(TYPE_ATR))){ throw new StructureBuildingException("Bug in word rule for amineDiConjunctiveSuffix"); } resolveWordOrB...
35acfe3e-f4ec-4ee4-b3ae-4440063e04f5
5
@Override public List<E> inRectangle(Vector corner1, Vector corner2) { ArrayList<E> toReturn = new ArrayList<>(); for (E item : list){ Vector p = item.getPosition(); if (p.x >= corner1.x && p.x <= corner2.x && p.y >= corner1.y && p.y <= corner2.y) list.add(item); } return toReturn; }