method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
71df2e22-c694-4b6e-a07a-c01f5851d85b
8
public void stop() { if (isHuge && getDirection() == Direction.LEFT) { this.setImageIndex(15); } else if (isHuge && getDirection() == Direction.RIGHT) { this.setImageIndex(11); } else if (!isHuge && getDirection() == Direction.LEFT) { this.setImageIndex(7); } else if (!isHuge && getDirection() == Direc...
a1345a9f-0e11-439c-b303-0517b84463df
7
@SuppressWarnings("unchecked") private void trickleDown(int pos) { int right = (pos+1)*2; int left = (pos*2)+1; int large = 0; if (right >= tNodes.length && left >=tNodes.length) return; if (right >= tNodes.length) { if (((T)tNodes[left]).compareTo((T)tNodes[pos]) < 0) swap(left, pos); else ...
da5ceb02-c64b-4b82-86b7-f65eaa99bd7b
2
public List<Event> getEvent(){ List<Event> events = new ArrayList<Event>(); for (Token tkn : tokenList){ //TODO KursTitel - Kurstitel und URL der noch ausgeschnitten werden muss if (tkn.type.name.contains("KursTitel")){ System.out.println(tkn.content); } //TODO Notiz - Anfangs + Endzeit, Häufigkeit ...
73c2e6f5-a385-4e4b-aadd-16c0cdaf46c3
6
private final void SetupParameters(){ final List<Parameter> parameter = Renderer.getParameters(); final Map<Parameter,String> arguments = new HashMap<Parameter,String>(); boolean error = false; for( Parameter param: parameter ){ final String value = GetParameter( param.LongName, param.De...
7184a28a-5abc-4495-a9df-2150f51e4b58
2
public static void writeFromInputStream(InputStream in, String filePath) throws IOException { FileOutputStream fos = new FileOutputStream(new File(filePath)); FileChannel fc = fos.getChannel(); ReadableByteChannel rbc = Channels.newChannel(in); ByteBuffer buffer = ByteBuffer.allocate(BUFFER_SIZE); while (t...
671121bf-084c-4461-b59a-31acd4843f08
4
public Board(JFrame window, boolean fullscreen, int windowWidth, int windowHeight, int bitDepth) throws IOException { myWindow = window; isFullscreen = fullscreen; displayMode = new DisplayMode(windowWidth, windowHeight, bitDepth, DisplayMode.REFRESH_RATE_UNKNOWN); if(windowWidt...
4f74b900-375a-4767-9e89-0c8839780a96
0
private void jButtonCloseActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonCloseActionPerformed ctrlP.close(); }//GEN-LAST:event_jButtonCloseActionPerformed
1977f6b6-c915-425d-b5f9-c2d3d2c9c84f
2
private void regulateFPS(final long timeStart, final long DELTA_TARGET_NANOS) { long timePassed = System.nanoTime() - timeStart; if (timePassed < DELTA_TARGET_NANOS) { long sleepTime = DELTA_TARGET_NANOS - timePassed; long millis = sleepTime / (1000 * 1000); int nano = (int) (sleepTime % (1000 * 1000)); ...
b70a5d3f-6ae4-4d94-8a2c-7ee99ca2453c
4
public void agilityComplex(int screen) { if (screen == 1) { clearMenu(); menuLine("1", "Gnome Agility Course", 2150, 0);// swamptoad menuLine("1", "Gnome Ball", 751, 1);// gnomeball menuLine("1", "Low-Level Agility Arena Obstacles", 2996, 2);// arena // ticket menuLine("20", "Medium-Level Agility Ar...
154a24f7-aeb8-40cf-8bcf-55ccdd89627e
7
public int[] twoSum(int[] numbers, int target) { if (numbers == null || numbers.length == 0) return null; int[] res = new int[2]; if (numbers.length == 1) { if (numbers[0] + numbers[0] == target) { res[0]= 1; res[1]= 1; } else { return null; } } Map<I...
5451c3c6-1d09-46e8-8450-8d9e8407909e
4
@Override public void deserialize(Buffer buf) { super.deserialize(buf); worldX = buf.readShort(); if (worldX < -255 || worldX > 255) throw new RuntimeException("Forbidden value on worldX = " + worldX + ", it doesn't respect the following condition : worldX < -255 || worldX > 255"...
5b3a4e7d-8fe5-4480-9127-1d35d026685e
9
public static List<TextItem> loadCSV(final File file) { final List<TextItem> res = new ArrayList<TextItem>(); if(file.exists()) { // Read File Line By Line float max = Float.MIN_VALUE; float min = Float.MAX_VALUE; try { final CSVReader reader = new CSVReader(new FileReader(fil...
6a668e47-fe4b-4f59-980a-ca6a4a6603bd
4
public ArrayList<String> readFileIn() { FileInputStream fis = null; BufferedReader reader = null; try { fis = new FileInputStream("/Users/jackgraham/Dropbox/Honours Project/Prolog/murder.pl"); reader = new BufferedReader(new InputStreamReader(fis)); ...
126203bf-63bb-45b1-a98f-160830e7a624
5
public boolean deleteRedundant() { boolean ret = false; introns = null; // These need to be recalculated //--- // Delete redundant exons //--- Map<Marker, Marker> includedIn = MarkerUtil.redundant(subintervals()); for (Marker exon : includedIn.keySet()) { ret = true; remove((Exon) exon); // Cha...
1916f966-4903-478b-8e4c-f2ebba2ea0de
5
public Connection setConn() { try { /* The connection specifies create=true to cause the database to be created. To remove the database, remove the directory AttackDB and its contents. The directory AttackDB will be created under the direct...
1a1298f6-c8cd-4038-be9e-1d0aa70d68d8
2
public String getVariableAttribute(Element root, String varName, String attributName){ Namespace ns = root.getNamespace(); Element variables = root.getChild("variables", ns); String value = null; for (int i=0; i < variables.getChildren().size(); i++){ Element variable = (Element)variables.getChildren...
78741cbb-7d0c-4367-aae6-ebbabc0589f9
7
public static ArrayList<HashSet<Integer>> integrateSet(ArrayList<HashSet<Integer>> setofSet) { HashSet<Integer> Exception = new HashSet<>(); ArrayList<HashSet<Integer>> clusterList = new ArrayList<>(); while (setofSet.isEmpty() == false) { HashSet<Integer> candidate = new HashSet<>()...
3208f53b-3343-4719-8786-6447afcae67c
2
public Connection getConnection() { if (connection == null) { try { return cpds.getConnection(); } catch (SQLException e) { throw new RuntimeException(e); } } else { return connection; } }
05b69aae-86cb-4fd7-8e38-f8a2bfe7f751
8
public void InputChar_eNFA(char input){ for (int i = 0; i < mStates.size(); ++i) mStates.get(i).mOld = true; /* for (int i = 0; i < mTransitions.size(); ++i){ State state1 = mTransitions.get(i).mCurrentState; State state2 = mTransitions.get(i).mNextState; if (mTransitions.get(i).mInputC == input && s...
bb854377-5b8e-43ce-b454-09ab8d2f82a5
0
public SQLPermissionBase(String n) { name = n; }
743c4dd7-86ea-4ecd-949c-6d93f19e946e
9
protected final void CreateAddWindow() { try { log.debug("Add new stick item:\n" + model.getWarehouseTableModel()); Object[] options = { "Add item", "Cancel" }; intFormat = NumberFormat.getIntegerInstance(); numFormat = NumberFormat.getNumberInstance(); nameField = new JTextField(); idField = new...
205ee8b7-6dd8-4e83-82d5-01172e7f631b
1
public void writeStrings(String content) { try { writer.flush(); writer.write(content); } catch (IOException e) { e.printStackTrace(); } }
087f8493-5d25-4b4e-8cca-8d51446804d0
1
@Override public void messageReceived(ChannelHandlerContext ctx, MessageEvent e) throws Exception { try{ //обработка входящего пакета BigEndianHeapChannelBuffer packet = (BigEndianHeapChannelBuffer)e.getMessage(); //шапка пакета short se...
510d06d4-5cef-45d1-a779-f7a1334efeef
8
private static Map/*<methodName, Map<typeName, Set<Local>>>*/ getLocals() { Map classMap = new HashMap(); Collection classes = Scene.v().getApplicationClasses(); Iterator ci = classes.iterator(); while (ci.hasNext()) { SootClass sc = (SootClass) ci.next(); Map<String, Map> methodMap = new HashMap<Strin...
96589ac2-2bce-4fa5-ba4c-85990e7fe89e
4
private EziInfo readEziInfoFile(File eziFile) { FileInputStream fileInput = null; EziInfo eziInfo = null; try { fileInput = new FileInputStream(eziFile); ObjectInputStream objectInput = new ObjectInputStream(fileInput); eziInfo = (EziInfo) objectInput.readObje...
ce4724ff-84b0-4cb4-8e75-de6533505a76
3
public DDJOInitializer(Server server) { if(server == null) { throw new NullArgumentException("server"); } if(!server.isRunning()) { throw new IllegalArgumentException("Given server is not running"); } for(HostedConnection con : server.getConnectio...
4c83f7d5-21af-45f9-ade5-cb22ffa224b4
2
protected void saveBackupFile (String fileName) { File backupFile = new File(fileName); String backupFileName; try { backupFileName = backupFile.getCanonicalPath(); if (backupFileName.contains(".")) backupFileName = backupFileName.substring(0, backupFileName.lastIndexOf('.')); SimpleDateFo...
4248b52a-35ec-4caf-87eb-cc5bfa784b72
6
public void setEditValue(int n, EditInfo ei) { if (n == 0 && ei.value > 0) { triggerI = ei.value; } if (n == 1 && ei.value > 0) { holdingI = ei.value; } if (n == 2 && ei.value > 0) { cresistance = ei.value; } }
d8d23cdb-9b2c-4fab-817d-96baa4f340dc
4
public void handleClass(Element e) { String id = e.getAttributeValue("Id"); if(id == null || EntityMeta.all_entities.get(id) != null) return; ClassMeta c = new ClassMeta(); c.id = id; c.name = e.getAttributeValue("Name"); c.is_abstract = Boolean.parseBoolean(e.getAttributeValu...
ebc82908-53da-48d9-82c4-383fdb23a8b9
2
public static String lookupColumnName(ResultSetMetaData resultSetMetaData, int columnIndex) throws SQLException { String name = resultSetMetaData.getColumnLabel(columnIndex); if (name == null || name.length() < 1) { name = resultSetMetaData.getColumnName(columnIndex); } return name; }
e6d13b43-3173-4891-b78b-0d1898e84064
2
private void cbxSemCNPJActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cbxSemCNPJActionPerformed if(cbxSemCNPJ.isSelected()){ txtCPF.setEnabled(true); txtCNPJ.setEnabled(false); txtCPF.grabFocus(); txtCNPJ.setText(null); }else if(!cbxSem...
1e73f40e-2659-4edc-bdda-4484c278109d
4
public static Paiva haePaivaIdlla(int id) throws NamingException, SQLException { Yhteys tietokanta = new Yhteys(); Connection yhteys = tietokanta.getYhteys(); String sql = "SELECT * FROM Paiva WHERE id = ?"; PreparedStatement kysely = yhteys.prepareStatement(sql); kysely.setInt(1...
7d89253c-b328-4748-a231-2dcc296ef442
8
public void print(String dataStructure) { System.out.print(dataStructure + ": "); for (int i = 0; i < size; i++) if (heap.get(i) != null) System.out.print(heap.get(i).element() + " "); else System.out.print("--"); System.out.println(); int nBlanks = 32; int itemsPerRow = 1; int column = 0; ...
d3045cb9-04d3-4397-9709-9292ba203076
7
public void setSource(File file) throws IOException { File original = file; m_structure = null; setRetrieval(NONE); if (file == null) throw new IOException("Source file object is null!"); // try { String fName = file.getPath(); try { if (m_env == null) { m_e...
51703f21-d12c-46c4-923c-4eb8fd70a5d1
7
public static void main (String[] args){ // Start by creating a person // toString to test that person Person ryan = new Person("Ryan","6134067060",24); System.out.println(ryan.toString()); System.out.println(); // Next is a Savings account // Start by depositing 2...
8870b290-7575-46cf-a3e2-dd926ed3481c
5
public static void main(String[] args){ try { test = ImageLoader.createImageIO("yellowcircle.png"); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } GraphicsHolder testHolder = new GraphicsHolder(); try { testHolder.addGraphic(test,"testName1"); testHolder....
913829b2-c3bc-465d-8f55-9b5b034a60a1
4
public static void TestMethod3() { TestMethod2(); for(int i = 0; i < 50; i++) { try { obj.objectWrite(student.getStudent(i), student.getStudent(i).getName()); } catch(IOException ex) { ex.printStackTrace(); } } StudentCollection collection = new StudentCollection(); for(i...
37230383-591e-4411-9ae2-6f5c446524e5
6
public static void downloadLists() { PrintWriter printer = null; try { printer = new PrintWriter("snackList.txt"); //from website try { Scanner website = new Scanner(new URL("http://jimisthebest.cs.net/csc202/foodList.html").openStream()); while (website.hasNextLine()) { printer.pr...
a38ab603-75ed-4fe8-b549-b0c931616bc3
6
static public String numberToString(Number n) throws JSONException { if (n == null) { throw new JSONException("Null pointer"); } testValidity(n); // Shave off trailing zeros and decimal point, if possible. String s = n.toString(); if (s.indexOf('.') > 0 ...
e53b23a2-7ff3-40e6-864d-025ba4266599
7
private int insertCssClass(int delta, Path path, int index, boolean closeAttribute, boolean renderD, String... additionalCssClasses) { index++; if (renderD) { insert(delta, "d='", path, "'"); } if (additionalCssClasses != null) { insert(delta, renderD ? " " : "", "class='"); boolea...
d6e6f6d6-d90f-4de4-8a49-09d69609f5de
4
@Override public void addElement(K p) { if (size() == capacity()) ensureCapacity(size()); if (isEmpty()) super.addElement(p); else { Object p1 = elementAt(0); Object p2 = elementAt(size() - 1); if (p.toString().compareTo(p1.toString()) <= 0) { insertElementAt(p, 0); } else if (p.toString().compar...
2017a781-12a9-4bb5-9d39-81b6fdf7d14e
7
private JSONWriter append(String s) throws JSONException { if (s == null) { throw new JSONException("Null pointer"); } if (this.mode == 'o' || this.mode == 'a') { try { if (this.comma && this.mode == 'a') { this.writer.write(','); ...
69b1d5ce-17c7-4d1c-968b-5fe6f674bb15
8
@Override public void setViewingPlatform(ViewingPlatform vp) { super.setViewingPlatform(vp) ; if (vp == null) { detachEcho() ; return ; } Viewer[] viewers = vp.getViewers() ; if (viewers != null) { // Get the View from the first Viewer attached to the // Viewing...
7648c09b-0582-4ac4-af46-2fc31eb9db66
0
@Override public YamlPermissionRcon getRcon() throws DataLoadFailedException { checkCache(PermissionType.RCON, "rcon"); return (YamlPermissionRcon) cache.get(PermissionType.RCON).get("rcon"); }
40cb9cfe-3579-4705-b392-27a5a941ec92
1
public Action getCurrAction() { try { return (Action)actions.peek(); } catch (Exception ex) { return null; } }
f6a51aa3-caee-4a8a-962d-536574c23dd5
0
public Ingreso(String concept, float importe) { super(concept, importe); this.tipo = "ingreso"; }
37ae5a95-f499-434b-a636-87055e7f68eb
2
@Override public void sendMessage(Message message) { try { if (ishost){ objectWriter = new ObjectOutputStream(connectionSocket.getOutputStream()); } else { objectWriter = new ObjectOutputStream(clientSocket.getOutputStream()); } ...
4fda625f-5d45-401f-a695-b7529973d019
5
static private int jjMoveStringLiteralDfa7_0(long old0, long active0) { if (((active0 &= old0)) == 0L) return jjStartNfa_0(5, old0); try { curChar = input_stream.readChar(); } catch(java.io.IOException e) { jjStopStringLiteralDfa_0(6, active0); return 7; } switch(curChar) { cas...
9ad99f2d-82db-4039-94b1-9936bf0c440d
9
private boolean r_Step_4() { int among_var; int v_1; // (, line 91 // [, line 92 ket = cursor; // substring, line 92 among_var = find_among_b(a_5, 19); if (among_var == 0) ...
d5995b1f-7346-49d5-b39a-a88464afe909
5
public Tile[][] generateReverseLBlock() { Tile[][] piece = new Tile[2][3]; for (int i = 0; i < piece.length; i++) for (int j = 0; j < piece[i].length; j++) { if (i == 1 || (i == 0 && j == 2)) ...
86c048bb-fd2a-4d90-9abe-c8d25ad049f2
2
public BufferedImage getRawImage(){ //Set up our framework to grab images FrameGrabber grabber = new VideoInputFrameGrabber(0); //Try to grab an image try { //Start (open up) the frame buffer grabber.start(); ...
c938b98d-df21-4fc5-9f8c-4258263e85ea
3
@Override public boolean allNodesAssignedToDominantClusterInNeighbourhood(){ boolean result = true; NodeIterator graphNodesIterator = this.LPAClusteringEngine.getGraph().getNodes().iterator(); while (graphNodesIterator.hasNext() && result && !this.LPAClusteringEngine.getIsC...
a1f79dd6-9c7d-47da-aad1-c2205bb87264
6
public int maxArea(int[] height) { int max = 0; int i=0; int j=height.length-1; int h1 =height[i]; int h2 = height[j]; while (i<j) { if (height[i] > h1) h1 = height[i]; if (height[j] > h2) h2 = height[j]; if (Math.min(h1,h2) * ( j - i) > max) max = ...
d7b1f3b4-0842-462b-9e9f-bd28f6fd0af0
6
@Override public void actionPerformed(ActionEvent e) { //System.out.println("BackspaceAction"); OutlinerCellRendererImpl textArea = null; boolean isIconFocused = true; Component c = (Component) e.getSource(); if (c instanceof OutlineButton) { textArea = ((OutlineButton) c).renderer; } else if (c ins...
d045a092-8444-48d5-80eb-c112033b220f
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 Timeslot)) { return false; } Timeslot other = (Timeslot) object; if ((this.id == null && other.id != null) || (...
8234a22c-5e87-4e4d-b115-7d5bf05e62f0
3
public Object getValueAt(int row, int col) { if(row>-1 && col>-1 && data!=null) return data[row][col]; else return null; }
d31f15d9-d979-4a7d-929d-313e02357600
0
@Override public WebDriver getWebDriver() { DesiredCapabilities caps = new DesiredCapabilities(); caps.setJavascriptEnabled(true); caps.setCapability(PhantomJSDriverService.PHANTOMJS_EXECUTABLE_PATH_PROPERTY, "src/test/resources/phantomjs"); caps.setCapability("takesScreenshot", true);...
7954aa1f-20cf-431a-b16e-bc621776be84
2
public boolean setNbCouleurs(int nvNbCouleurs){ if(nvNbCouleurs >= MIN_NB_COULEURS && nvNbCouleurs <= MAX_NB_COULEURS){ Integer nbCouleur = nvNbCouleurs; propriete.setProperty("nb_couleur", nbCouleur.toString()); return true; } else{ return false; ...
3a3a3100-6b36-4d34-8baf-617ecba22b15
4
public static void filledEllipse(double x, double y, double semiMajorAxis, double semiMinorAxis) { if (semiMajorAxis < 0) throw new IllegalArgumentException("ellipse semimajor axis must be nonnegative"); if (semiMinorAxis < 0) throw new IllegalArgumentException("ellipse semiminor axis must be nonnegativ...
c1ab7732-5d6d-4ff1-84ea-6dded5fc2fb2
2
public void sendMessage(Message message) { try{ writer.writeObject(message); writer.flush(); } catch(NullPointerException e) { ClientHelper.log(LogType.ERROR, "Kein Outputstream für " + ip + ":" + port + " vorhanden"); } catch(IOExc...
b5763a06-c912-4f5f-8092-f9145640516d
1
public void shiftRight() { point.setLocation(location); point.translate(1, 0); if (assertLegal(pane, block, point, block, location)) { free(); location.translate(1, 0); calcShadowDrop(); draw(); } }
b35b941e-367a-4615-aa84-ba1393405e4c
2
private void createUsers(Scanner s, ArrayList<User> users, ArrayList<String> usersText) { // method to read Users.txt file and create user Objects while (s.hasNextLine()) { usersText.add(s.nextLine()); // fill string arraylist with lines from Users.txt } for (int i = 0; i < usersText.size(); i++) { // read eac...
2d6daf46-1a37-4222-845f-e8e5a71990c5
8
public void update() { boolean startJump = false; if (keyUp & onGround) { startJump = true; yMoveMent = jumpSpeed; } else { yMoveMent += falingSpeed; if(yMoveMent > maxfalingSpeed){ yMoveMent = maxfalingSpeed; } } if (keyRight) { xMoveMent = speed; lookingRight = true; action = ACT...
ced96eae-23f5-4bd2-9d40-6bdb4b9337fe
2
public static void main(String[] args) { List<Class> myClasses=new ArrayList(); myClasses.add(CommandLogTest.class); myClasses.add(GamesTest.class); myClasses.add(GameTest.class); myClasses.add(MovesTest.class); myClasses.add(UserTest.class); Result result;// = JUnitCore.runClasses(MyCla...
47754f41-b251-407b-b4e3-ca4448072ca4
2
public Beta(double alpha, double beta) throws ParameterException { if (alpha <= 0 || beta <= 0) { throw new ParameterException("Beta parameters alpha > 0, beta > 0"); } else { gamma1 = new Gamma(alpha, 1); gamma2 = new Gamma(beta, 1); this.alpha = alpha; this.beta = beta; } }
dc7f41ba-0b5c-4c6d-802e-aea48f5a9494
2
public void set(int index, E element) { if (index >= 0) { if (index < size) { array[index] = element; } } }
845df6ef-c449-4331-ac9d-30ade1fd2fc8
6
@Override public void runStartupChecks() throws EngineException { Engine eng = FreeForAll.getInstance().getEngineManger().getEngine("OfflineStorage"); if (eng != null) { if (eng instanceof OfflineStorageEngine) { this.OSE = (OfflineStorageEngine) eng; } } eng = FreeForAll.getInstance().getEngineMange...
75758d89-9cc5-4c2f-a539-4c1ee2e362e9
3
public void remember(){ zeroBeings.clear(); for (Being being: beings){ if (being.isHuman()){ zeroBeings.add(new Human(being.getX(), being.getY())); } if (being.isZombie()){ zeroBeings.add(new Zombie(being.getX(), being.getY())); ...
6ea07b11-698f-45d4-8e97-eed9a4a86bf6
0
public void setLast(Items last) { this.last = last; }
62f4bcdc-a3e4-4e0a-b67d-25fdabf2137b
2
public void testWithers() { YearMonthDay test = new YearMonthDay(1970, 6, 9); check(test.withYear(2000), 2000, 6, 9); check(test.withMonthOfYear(2), 1970, 2, 9); check(test.withDayOfMonth(2), 1970, 6, 2); try { test.withMonthOfYear(0); fail(); } ca...
93fc96d9-eec6-4907-b09a-b05792512749
9
public Config() throws IOException { BufferedReader reader; try { reader = new BufferedReader(new FileReader("config.ini")); } catch (FileNotFoundException e) { System.out.println("No config.ini file found."); return; } String line = reader.readLine(); while (line != null) { try { String...
6e90f8a7-31f8-47c6-b328-e2315920baad
8
private void draw(RenderItem renderItem) { VertexData vertexData = renderItem.getShape().getVertexData(); LinkedList<VertexData.VertexElement> vertexElements = vertexData.getElements(); int indices[] = vertexData.getIndices(); // Don't draw if there are no indices if(indices == null) return; // Set the...
f99d4a93-5210-4d74-a684-aa4b8b1efedb
5
public static void execInsert (String query) { Statement st = null; Connection dbConnection = null; try { dbConnection = getDBConnection(); st = dbConnection.createStatement(); st.executeUpdate(query); } catch (SQLException e) { e.getMessa...
9ca50c4f-1c8c-4e39-ba24-7895a022fb20
1
public boolean collisionSide(Obstacle[][] obs,int i, int j, int k, int l) { // Left side boolean collide = collisionSideHelp(obs,i,j,l); while (k<width){ // move to right side k += Obstacle.getWidth(); ++j; } // Right side collide |= collisionSideHelp(obs,i,j,l); return collide; }
3cc16eaf-5fc5-4b70-ba33-584143c03b95
6
private void refresh(HuntField matrix) { label.setText("Hunters "+matrix.getNumberOfItems('H')+ " Ducks "+matrix.getNumberOfItems('D')); for (int i = 0; i < bMatrix.length; i++) { for (int j = 0; j < bMatrix[0].length; j++) { if (matrix.getItemType(new Position(i, j)) == 'D')...
e99e431c-a860-4cf5-910d-511d557b4684
8
public DsDef(String dsName, DsType dsType, long heartbeat, double minValue, double maxValue) { if (dsName == null) { throw new IllegalArgumentException("Null datasource name specified"); } if (dsName.length() == 0) { throw new IllegalArgumentException("Datasource name len...
5dea2278-d543-4981-86f8-297de49ec2a1
8
@Test public void testExperiment4() { int total = 0; int count = 0; for (int i = 0; i < mServerCount; i++) { try { mDhtClientArray[i].purge(); } catch (RemoteException e) { e.printStackTrace(); System.out.printl...
5158a562-05d5-406e-8be9-64d9b1437651
6
private void configureSpeed() { speed = new JPanel(); speed.setBackground(Color.WHITE); speed.setBorder(BorderFactory.createTitledBorder("Speed")); speed.setMaximumSize(new Dimension(Variables.GENERAL_PANEL_WIDTH, 80)); slider = new JSlider(0, 100, 20); slider.setBackground(Color.WHITE); slider.setMajorTi...
4b8678aa-8ff3-4a6d-8705-74d5cdda8827
8
public void renderPlayer(int xp, int yp, Sprite sprite) { xp -= xOffset; yp -= yOffset; for (int y = 0; y < 32; y++) { int ya = y + yp; for (int x = 0; x < 32; x++) { int xa = x + xp; if (xa < -32 || xa >= width || ya < 0 || ya >= height) break; if (xa < 0) xa = 0; int col = sprite.pixels[x ...
9428e920-7bee-4911-9667-c730a786faf5
5
public static boolean next_permutation(int[] vec) { int tmp; for (int i = vec.length - 2; i >= 0; i--) if (vec[i + 1] > vec[i]) for (int j = vec.length - 1; j >= 0; j--) if (vec[j] > vec[i]) { tmp = vec[i]; vec[i] = vec[j]; vec[j] = tmp; for (int k = i + 1, l = vec.length - 1; k ...
9c0a69e0-4c07-47c7-bf30-e2954f40f6b0
8
@SuppressWarnings("rawtypes") @Override protected void checkAfterParse(Method method) throws DaoGenerateException { super.checkAfterParse(method); MongoMapper mapper = method.getAnnotation(MongoMapper.class); Class<? extends BeanMapper> mapperType = AutoDetectBeanMapper.class; if (mapper != null) { mapper...
8159b4e4-f366-454f-9b0e-3356bcc275fb
2
public void getMoveTarget() { if(Application.get().getLogic().getGame().getSector(currentSector) != null) { EnemyLocation loc = Application.get().getLogic().getGame().getSector(currentSector).reserveLocation(owner); if(loc != null) { targetX = loc.x(); tar...
bfee20c5-0ab1-4109-a6ab-33b5039a47dd
4
public void Clear() { posVec = null; fdirVec = null; sdirVec = null; x = 0; y = 0; z = 0; cartLLabel.setVisible(false); cartLUabel.setVisible(false); vecLLabel.setVisible(false); cartPLabel.setVisible(false); vecPLabel.setVisible(false); for (JTextField j : vecLInputs){ j.setVisible(false)...
af6ea145-cd3f-45fb-9c38-3e90a3efea1a
6
public static boolean fourOfaKind(Hand hand) { hand.sortByValue(); if (( (hand.getCard(0).getValue() == hand.getCard(1).getValue()) && (hand.getCard(0).getValue() == hand.getCard(2).getValue()) && (hand.getCard(0).getValue() == hand.getCard(3).getValue()) ) || ( (hand.getCard(4).getValue(...
4b0ab78e-7e69-4de1-b80c-5f73d6f98dd6
7
@Override void replaceChild(@SuppressWarnings("unused") Node oldChild, @SuppressWarnings("unused") Node newChild) { // Replace child if(this._id_ == oldChild) { setId((TId) newChild); return; } for(ListIterator<PDecl> i = this._decl_.listIterator(...
a419a341-0217-4647-8d29-4832cea7c35c
0
public void setNonPH(int i, String time){ int hr, min; hr = Integer.parseInt(time.substring(0,2)); min = Integer.parseInt(time.substring(3,5)); nonPeakHr[i].set(0,0,0,hr,min); }
92c05b1e-cc96-4d13-9b69-85fa5711646f
4
public void removeTemporarySources() { Set<String> keys = sourceMap.keySet(); Iterator<String> iter = keys.iterator(); String sourcename; Source srcData; // loop through and cleanup all the sources: while (iter.hasNext()) { sourcename = iter.next(); srcData = sourceMap.get(sourcename); if ((srcDat...
eaa23bad-d444-4910-835e-fae8db3149c6
7
private void buildRootList(final Collection c, final boolean reverse) { final HashSet visited = new HashSet(nodes.size() * 2); final ArrayList stack = new ArrayList(); final Iterator iter = nodes.values().iterator(); while (iter.hasNext()) { final GraphNode node = (GraphNode) iter.next(); if (!visited....
78e18c5e-dbb4-4107-be57-f08c6979f126
4
void deleteTime(Component dialogParent, Time time) { if (time != null) { if (AlertMessages.deleteTimeConfirmation(dialogParent, time)) { try { timeDao.deleteTime(Dao.getConnection(), time); timeDialog.setTime(null); timeListDialog.selectPreviousRow(); timeDialog.setVisible(false); } cat...
ed786ed8-6a16-410a-ac20-6c0d38bef4b0
0
public String getTableName() { return tableName; }
40ae6e29-d637-4d21-92b3-6dbdda0509d5
8
@Override public void actionPerformed(GUIComponent source) { if (source == nameButton) { nameInput.setEntryText(""); nameInput.activate(); } else if (source == nameInput) { nameButton.setText(nameInput.getEntryText()); } else if (source =...
51cc0531-1963-4454-9a05-8c2628fe52de
0
@Override public void remove() { }
2ecd938a-cef2-4052-8db3-0336bad25662
4
private static List<Path> getDependencyKmdFiles(CommandLine line) throws IOException { if (line.hasOption(DEPROM)) { String[] kmdPathNames = line.getOptionValues(DEPROM); List<Path> kmdFiles = PathUtils.getPaths(kmdPathNames, "*.kmd.json"); if (kmdFiles.isEmpty()) { String paths = null...
ae79343d-475a-4eac-831e-3b0e7c7cd49f
5
protected Point getTownSnap() { Placeable placeable = currentlyPlacing; if (placeable != null) { int x = (gameController.getCurrentMousePosition().x + gameController.getMapOffsetX()) / BlockManager.getBlockWidth() * BlockManager.get...
930e0f77-8b2f-4442-afca-cbc249ffab1c
2
private double average(int[] record){ int sum=0; int i; double avg; int ct = 0; for (i=0;i<record.length;i++){ sum = sum+record[i]; System.out.printf("\n the %d th record is %d\n",i, record[i]); if (record[i]!=0) ct=i; } avg = sum/(ct+1); System.out.printf("\n the avg score is %f\n", avg); ...
2b757025-1f54-4a46-8c3f-d5df7605218d
8
public EntryGenerator<K, V> mixWithNulls(final float selectThisGenerator, final boolean mixWithNullKeys, final boolean mixWithNullValues) { assertTrue(selectThisGenerator >= 0 && selectThisGenerator < 1); if (!(mixWithNullKeys || mixWithNullValues)) { return EntryGenerator.this; ...
c3299efb-8b6c-4f5a-b1e8-ca8e093b6717
9
@Override public void importFileToDB() { ArrayList a = super.readFile(); Iterator b = a.iterator(); while (b.hasNext()) { String line = (String) b.next(); if (line != null) { String[] splitLine = line.split(";"); if (splitLine[0].lengt...
b64ecd87-2288-431b-abd4-25bcd56cf659
5
public HashMap<String, Mass> makeMasses() { float x; float y; float mass; double vx; double vy; NodeList nodes = myDoc.getElementsByTagName(MASS); for (int i = 0; i < nodes.getLength(); i++) { // Default values vx = 0; vy = 0; mass = 5f; Node massItem = nodes.item(i); NamedNodeMap node...
7e7db0df-0300-4f3d-93e4-317461ad3485
3
public double readDouble(String pSection, String pKey, double pDefault) { //if the ini file was never loaded from memory, return the default if (buffer == null) {return pDefault;} Parameters params = new Parameters(); //get the value associated with pSection and PKey String valueText = getValue(p...
270470fb-262e-4204-a04f-f5deaeb22457
0
public void setValue(int value) { this.value= value; }