method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
452e99c9-e005-478f-8f41-dbc5c8622d58
1
private boolean outdated() { return sourceLastUpdated().compareTo(siteLastUpdated()) < 0 ? true : false; }
7f82c470-abc1-4f6a-b903-9b9c5c622c45
2
public ArrayList<BacklogBean> getPage(int intRegsPerPag, int intPage, ArrayList<FilterBean> alFilter, HashMap<String, String> hmOrder) throws Exception { ArrayList<Integer> arrId; ArrayList<BacklogBean> arrBacklog = new ArrayList<>(); try { oMysql.conexion(enumTipoConexion); ...
a3f51764-2e9c-4aa4-8fb7-48047be309d8
2
public float getAngle(long lifeTime) { // North if(pattern[0] == 0) { return (float)(Math.toRadians(offset[0]+270)); } // Spiral, three times. else if(pattern[0] == 1) { float percent = (float)(lifeTime/life); return (float)Math.toRadians(offset[0]+(float)(lifeTime)/(float)(life)*360*2-percent); } /...
3fde6b07-39ba-4fce-a063-c01a3c751dc3
4
public boolean isSearched(String url) { String url_end_ = ""; if (url.endsWith("/")) { url_end_ = url.substring(0, url.lastIndexOf("/")); } else { url_end_ = url + "/"; } if (getSearchedSites().size() > 0) { if (getSearchedSites().indexOf(url) != -1 || getSearchedSites().indexOf(url_end_) != -1) { ...
81366f8f-a6ba-4578-a57c-95f3a972c5fe
1
private ArrayList<String> getArrayListSubClasses(String Declaration) { // TODO Auto-generated method stub ArrayList<String> stringarray = new ArrayList(); StringTokenizer st = new StringTokenizer(Declaration, ","); while(st.hasMoreElements()){ String id = st.nextToken(); stringarray.add(id.trim()); } ...
6bc9e8b1-3a1b-48a2-8221-f9c5febe4424
7
public static void generateEdgeHeuristics(int set) { // Make a cube and initialize it with a solved cube state Cube cube = new Cube(Cube.GOAL.toCharArray()); // Make a new Queue to perform BFS Queue<CubeNode> q = new LinkedList<CubeNode>(); // Put the solved/initial state of the cube on the queue q.add(ne...
1a0f04c2-6814-4b84-aac6-068e746a28d2
8
public void init() { // reservationButtonDisabled? reservationButtonDisabled = false; if (isReservationOld()) reservationButtonDisabled = true; if (!getBook().getTakeAway()) reservationButtonDisabled = true; if (!canReserveBook(sessionBean.getUser())) reservationButtonDisabled = true; // pdfAvailable? if...
ae7fae04-f84a-4d98-9142-2bf7172ff68f
9
ActivityReader(String fileName) throws IOException, LocalException{ validateActivityFile(fileName); list = new ArrayList<ViewType>(); br=new BufferedReader(new FileReader(file)); knownViews = new KnownViews(); xmlMeta=new HashMap<String,String>(); String line; while((line=br.readLine())!=null){ line...
c50764f9-472c-4fc8-bf03-f9f8ef68f7b1
3
private ArrayList<HashMap<String, Object>> extractSessions(Object courseId) { ArrayList<HashMap<String, Object>> list = new ArrayList<HashMap<String, Object>>(); ArrayList<Object> remove = new ArrayList<Object>(); for (Object key : this.sessions.keySet()) { HashMap<String, Object> ses = this.sessions.get(key);...
722b3848-7c8d-43af-af4d-0420c92d75dc
4
public boolean loadVcf() { //--- // Create data structure //--- Timer.showStdErr("Counting lines form file: " + vcfFileName); int numLines = Gpr.countLines(vcfFileName); Timer.showStdErr("Done. Number of lines: " + numLines); Timer.showStdErr("Loading file " + vcfFileName); VcfFileIterator vcf = new Vc...
090104e2-da20-4a61-bba3-277229d1e116
7
private void getUserInformation(){ if(userId!=null){ try { ResultSet userInfo = dataBaseConnector.getUserInformation(userId); userInfo.next(); scores = userInfo.getInt("scores"); money = userInfo.getInt("money");...
a7edcb13-4f0f-4c82-843e-8f9d6f87d2a7
7
public DateTime truncate(Unit aPrecision) { ensureParsed(); DateTime result = null; if (Unit.NANOSECONDS == aPrecision) { throw new IllegalArgumentException("It makes no sense to truncate to nanosecond precision, since that's the highest precision available."); } else if (Unit.SECOND == aPreci...
1899e8f5-10e5-4b49-b70a-24e52166bca8
3
private void btExcluirActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btExcluirActionPerformed int linhaSelecionada = -1; linhaSelecionada = tabela.getSelectedRow(); if (linhaSelecionada >= 0) { int i = (JOptionPane.showConfirmDialog(null, "Tem certeza que deseja e...
c755ecc2-845c-4044-b948-9a4e9553511d
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...
e38db31d-3e1c-4f0a-a1a0-466ef40624fd
8
public void invoke( List mbeans, String operation, boolean failFirst ) throws Exception { if( mbeans==null ) { return; } Iterator itr=mbeans.iterator(); while(itr.hasNext()) { Object current=itr.next(); ObjectName oN=null; t...
082474ba-08b0-4331-ae8e-c9eda7590d69
9
@Override public void run() { for (;;) { synchronized (iter) { if (iter.hasNext()) { currentZipEntry = iter.next(); } else { wr.getWw().threadOutMessage("Finished", id, 4); return; } } // Report what's happening if (!config.isForceRun()) { wr.getWw().threadOutMessage(" " + ...
03e41d83-d395-47ab-8a13-6ff41a5f0d83
9
public synchronized void run() { try { while (Thread.currentThread()==reader) { try { this.wait(100);}catch(InterruptedException ie) {} if (pin.available()!=0) { String input=this.readLine(pin); textArea.append(input); } if (quit) return; } while (Thread.currentThrea...
485b664e-6971-4b1f-b380-01217f2d1b4b
5
protected <A extends Actor> Action getAction(A a) { Set<Action> actions = a.actions(); Agent<A> agent = getAgent(a); if (actions.size() >= 0 && agent != null) { Action choice = agent.choose(a, Collections.unmodifiableSet(actions)); // If the agent returns a malicious Action, using // equals() or hashCode...
ef16e2c5-9305-4325-82fc-f686e20a9792
9
static protected void FillBuff() throws java.io.IOException { if (maxNextCharInd == available) { if (available == bufsize) { if (tokenBegin > 2048) { bufpos = maxNextCharInd = 0; available = tokenBegin; } else if (tokenBegin < 0) bufpos...
c12a745b-c0dd-4e8c-8f12-f8fabada3153
4
public void draw(Graphics2D g2d){ //Save affine transformation AffineTransform savedState = new AffineTransform(g2d.getTransform()); //Construct the local system AffineTransform localCoordinateSystem = constructLocalSystem(g2d.getTransform()); //Set the affine transformation g2d.setTransform(localCoord...
7e468262-983b-430c-b414-d7d3483edef0
4
public String toString() { final String[] SUITS = {"CLUBS", "DIAMONDS", "HEARTS", "SPADES"}; if (value == 0) { return "A" + " " + SUITS[suit] + " active: " + isActive + " removed: " + hasBeenRemoved + "||"; } else if (value == 12) { return "K" + " " + SUITS[suit] + " act...
ea53032d-6b09-49aa-a2f3-6546d849a44d
5
@Override public RedBlackTree.Node<T> delete(T value) { if (head != null && head.getValue().equals(value)) { head = getSuccessor(head); } RedBlackTree.Node<T> result = super.delete(value); if (result != null) { Node<T> linkedNode = (Node<T>) result; if (linkedNode.getPredecessor() !=...
0bc55929-5f80-4486-86d1-5a7cb70d519d
5
public static final boolean isChaosScroll(final int scrollId) { switch (scrollId) { case 2049100: // Chaos Scroll case 2049101: // Liar's Wood Liquid case 2049102: // Maple Syrup case 2049104: // Angent Equipmenet scroll case 2049103: // Beach Sandals ...
f18d168a-27db-4262-b0fe-dc6d759d45c2
1
public void setProperty(String key, String value){ try{ PersistentEntry persistentEntry = (PersistentEntry) em.createNamedQuery(PersistentEntry.FIND_BY_CATEGORY_AND_KEY). setParameter("category",getPropertiesFilename()). set...
7c4f4efd-160b-42a4-ac24-cf7e58cb77e7
6
public void nextPermutation(int[] num) { // Start typing your Java solution below // DO NOT write main() function int n = num.length; if (n < 2) return; int i = n - 1; while (i > 0 && num[i] <= num[i - 1]) i--; int j = n - 1; if (i > 0) { while (num[j] <= num[i - 1]) j--; swap(num, j, i ...
fd9753d4-c59b-4838-8137-a2c7aa8cd7f1
0
public HashMapStorage() { this.storage = new HashMap<String, Integer>(); }
24cad8fe-916c-4a0a-88f9-c50aee5791d7
6
public static void testMillerRabin(CryptobyConsole console){ final Scanner scanner = new Scanner(System.in); // Initial Variables int rounds; String percent; BigInteger number; // Input Number for Primenumber Testing do { System.out.println("S...
e0370bc4-b2fd-4a40-8262-5bbc7c47ddb4
8
public void sendTrap(PDU pdu, String ip) { PDUv1 trap = null; String generic = null; long minutes; if (pdu.getType() == PDU.V1TRAP) { trap = new PDUv1((PDUv1) pdu); minutes = trap.getTimestamp() /1000 / 60; switch (trap.getGenericTrap()) { case 0: generic = "COLDSTART"; break; case 1: ...
570729a5-4dfd-4c57-8c29-49d55af07a5b
3
public void renderWidthInvisColor(int xp, int yp, Sprite sprite, int color) { int w = sprite.getWidth(); int h = sprite.getHeight(); for (int y = 0; y < w; y++) { for (int x = 0; x < h; x++) { int col = sprite.getPixel(x + y * w) & 0xffffff; if (color != col) pixels[(x + xp) + (y+yp) * width] = co...
6272439b-03ba-4cdf-842e-e1ba8ba37c63
6
public ShadowCodeScanner() { ShadowColorProvider colorProvider = ShadowPlugin.getDefault().getColorProvider(); IToken defaultToken = colorProvider.getToken(ShadowColorProvider.DEFAULT); IToken literalToken = colorProvider.getToken(ShadowColorProvider.LITERAL); IToken typeToken = colorProvider.getToken...
aa025ab8-51f5-4809-bb2a-c2ea4f463416
3
public void hit(int damage) { if (flinching) return; health -= damage; LevelCompletedState.lives--; if (health < 0) health = 0; if (health == 0) { setDead(dead); score = 0; } flinching = true; sfx.get("playerhit").play(); flinchTimer = System.nanoTime(); }
50953a64-ace9-4826-a059-f295169198e5
1
public String getAntwoord() { if (_antwoord == null) return getTekst(); return _antwoord; }
78c70a1f-1d07-47dd-8d5b-340e6812ab36
1
private static void createZipFrom(final File dir) throws IOException { Files.walkFileTree(dir.toPath(), new FileVisitor<Path>() { Path tmp = dir.toPath(); @Override public FileVisitResult postVisitDirectory(Path dir1, IOException exc) throws IOException { ret...
205b6349-6637-4813-9d28-51c3d42535dd
2
private boolean parseGrid(Document doc) { NodeList nodes = doc.getElementsByTagName(XmlTag.GRID.toString()); //only care about the first timer set (ignore all other timer elements) Element gridNode = (Element) nodes.item(0); String gridWidth= gridNode.getAttribute(XmlTag.WIDTH.toString()); String gridHeight=...
f1f97b32-5f60-45f1-9892-47ffda273e7a
9
private void generateTraffic() { if((Config.debugMode() && m_msgIdCount == Config.maxMsgs() && Config.maxMsgs() > 0) || (Config.runMode() && Simulator.draining())) return; if(Config.traffic().equals(TrafficType.TRACE)) { // Take all of the pending trace events for this clock cycle for(Iterator<Trace...
3d3eee07-f70f-4596-ba98-27a555cb0413
8
String[] grades(String letter){ String[] ledger = new String[2]; double []precision = new double [1]; int []match = {0, 1, 2, 3, 4}; double grade = 0; if(letter.length()==2){ if(letter.charAt(1) == '-'){ //ledger[1] = String.format("%d%f", + (- 0.3)); ...
8c06003d-b533-4891-8a64-c9bff76df8bd
7
@Override public short[] getTerrainData(int px, int pz, int sx, int sz) { short[] res = base.getTerrainData(px, pz, sx, sz); for(int x = 0; x < sx; x++) for(int z = 0; z < sz; z++) { int y; int d = depth; for(y = Chunk.MAP_HEIGHT-1; y >= 0; y--) { int i = z + sz*(x + sx*y); if(re...
56b0f8e2-9ec6-4fa8-a3a9-311b110bd864
2
public EntradaBean loadId(EntradaBean oEntrada) throws ServletException { try { if (request.getParameter("id") != null) { oEntrada.setId(Integer.parseInt(request.getParameter("id"))); } else { oEntrada.setId(0); } } catch (NumberFormatE...
b1804eda-b546-485f-9f78-b4cbf6ef6546
2
public static void setAdditionalService(int additionalService) { if (additionalService > 3 || additionalService < 0) { Output.printTabLn("Maximal 3 zusätzliche Außendienste", Output.ERROR); } else { getInstance().additionalService = additionalService; } }
25aaec22-076f-4614-99e5-e08c366f7bf4
4
private void applyGravityField(Vector source) { List<Mob> affectedEntities = new ArrayList<Mob>(); List<Float> mags = new ArrayList<Float>(); List<Vector> disps = new ArrayList<Vector>(); float mag; Vector disp; for (Mob m : allPhysicalEntities) { disp = Vector.displacement( m.getPosition(),source); ...
49588123-edc2-4efd-9177-ba1a1e8170e6
5
@Override public MapleData getChildByPath(String path) { String segments[] = path.split("/"); if (segments[0].equals("..")) { return ((MapleData) getParent()).getChildByPath(path.substring(path.indexOf("/") + 1)); } MapleData ret = this; for (int x = 0; x < segments.length; x++) { boolean foundChild =...
d8847f00-9f32-4233-9b66-783a8ed2d7d9
7
@Override public void actionPerformed(ActionEvent e) { if (e.getSource().equals(addTile)) { operations.addImage(); } if (e.getSource().equals(changeLayer)) { switch (changeLayer.getText()) { case "1": changeLayer.setText("2"); ...
14f53b5c-2983-4aa0-93bf-d2af910ef478
8
public void avoid(PolarPoint obstacleLocation) { System.out.println("Avoiding..."); keepAvoiding = true; int turnDirection = 0; //1 for left, -1 for right boolean isLeftObstacle = true; boolean isRightObstacle = true; while (isLeftObstacle && isRightObstacle) { System.out.println("Look left and right...
80cdeac4-45e4-43ff-9344-454ffe02586d
7
public int mode() { HashMap<Integer, Integer> modes = new HashMap<Integer, Integer>(); for(int i = 0; i < x; i++) for(int j = 0; j < y; j++) { int num = array[i][j]; if(modes.containsKey(num)) modes.put(num, modes.get(num) + 1); else modes.put(num, 1); } int mode = array[0][0]; ...
78cf1edb-a723-40b5-8f63-e5460e992253
8
public Object stringToValue(String string) throws ParseException { Date date = null; int start = 0; int end = string.length(); try { int sep; int month, day, year; sep = string.indexOf('/'); if (sep <= 0) { setEditValid(fals...
6578d85d-9029-49af-afc8-53869a7fbb6d
7
public void luoUusiPutoava() { Random rand = new Random(); int satun = rand.nextInt(7); switch (satun) { case 0: this.putoava = new Muodostelma(Muoto.I, this); break; case 1: this.putoava = new Muodostelma(Muoto.S, this); ...
3fae5703-eda0-46c6-af7e-5413268b6f84
3
public void mouseReleased(MouseEvent e) { // update selection rectangle updateSelectionSize(e, pageViewComponent); if (documentViewModel.getViewToolMode() == DocumentViewModel.DISPLAY_TOOL_SELECTION) { // clear the rectangle clearRectangle(pageViewComponen...
72a8bbe6-ba9c-4271-9f86-3a6a0c351cf3
8
public static void main(String[] args) { Scanner in = new Scanner(System.in); int start = in.nextInt(); int end = in.nextInt(); for (int i = start; i <= end; i++) { if (i < 10) { System.out.print(i + " "); } if (i>=10 && i < 100) { if (i % 10 == i / 10) { System.out.prin...
537decc7-3eee-441d-a0d9-7c0da64daf3f
4
private void cancelPreviousPlayer() { FilePlayer.cancelPlayer = true; if (currentPlayer != null && !currentPlayer.isDone()) { currentPlayer.cancel(false); try { if (currentPlayer != null) currentPlayer.get(); } catch (InterruptedException | ExecutionException ex) ...
01a56168-1c1d-4155-89d2-441412394cf9
8
public static final boolean delClass(final CMObjectType type, final CMObject O) { if(O==null) return false; if(classes.containsKey(O.getClass().getName())) classes.remove(O.getClass().getName()); final Object set=getClassSet(type); if(set==null) return false; CMClass.lastUpdateTime=System.currentTim...
eef80c50-e091-4cb3-891c-5240df18215d
7
public static void removeStateChange(int objectType, int objectX, int objectY, int objectHeight) { for (int index = 0; index < stateChanges.size(); index++) { StateObject so = stateChanges.get(index); if(so == null) continue; if((so.getX() == objectX && so.getY() == objectY && so.getHeight() == object...
768fa00f-c6f2-4210-a717-e4f8f643c577
5
public static boolean isReservedPlusOp(String candidate) { int START_STATE = 0; int TERMINAL_STATE = 1; char next; if (candidate.length()!=1){ return false; } int state = START_STATE; for (int i = 0; i < candidate.length(); i++) ...
0d3f5cd0-49b3-4f30-9d9e-a95dd3444024
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...
0b6ff27a-7478-44ff-8cc9-71a93176f96a
8
public static final Object getArray(Buffer buffer) { if (buffer == null) { return null; } if (!(buffer instanceof ByteBuffer)) { if (!(buffer instanceof FloatBuffer)) { if (!(buffer instanceof IntBuffer)) { if (buffer instanceo...
bac9e5af-c009-410f-ae72-67d278919721
4
public boolean isEmpty() { if (!this.rock && this.ant == null && this.anthill.equals("none") && this.food <= 0) { return true; } else { return false; } }
ad3d8488-093f-43e6-89cd-e9e938d57b25
1
@Test @Parameters({ "Coffee", "Chocolate", "OrangeJuice", "Tea", "TomatoPotage" }) public void beverageQuantityChecker__10_quantity(String drink) { BeverageQuantityChecker beverageQuantityChecker = new BeverageQuantityChecker(); for...
e56c4a81-f374-4c01-97bf-a920a7113524
3
@Override public boolean equals(Object obj ) { if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } final ClientHandler other = (ClientHandler) obj; if (!Objects.equals(this.socket, other.socket)) { ...
7cfd47dd-418a-4de1-af85-e5471e14f6be
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...
e4a72d8a-1b63-4666-87e2-843e8efa2f0b
9
public static void main(String[] args){ Scanner in = new Scanner(System.in); N = in.nextInt()+1; int[] p = new int[N]; for(int i=2;i<N;i++) p[i]=1; for(int i=2;i<N;i++){ if(p[i]==1){ for(int j=i*2;j<N;j+=i){ p[j]=0; } } } int[] a = new int[N]; int[] index = new int[N]; for(int...
b262e335-f3dd-4cd5-b565-cfbb92909a58
5
void inplaceConcat(Fst<Label> other) { Map<State, State> other_to_this = this.stateFactory .importStates(other.states); Set<State> oldThisAccept = new HashSet<>(this.acceptStates); this.acceptStates.clear(); for (Entry<State, State> importPair : other_to_this.entrySet()) { this.setAccept(importPair.ge...
c2ae2e01-9935-421e-ae96-dfd8e3bb5fb8
3
void classification() { /* 353 */int[][] pixels = this.pixels; /* 355 */int width = pixels.length; /* 356 */int height = pixels[0].length; int y; /* 359 */for (int x = width; x-- > 0;) /* 360 */for (y = height; y-- > 0;) { /* 361 */int pixel = pixels[x][y]; /* 362 */int red = pixel >> 16 ...
86bde892-945b-49c5-9da0-ea72988032f9
3
private boolean doSelectClick(MouseEvent evt) { Point mousePoint = evt.getPoint(); Point2D.Float pt = m_camera.screenToWorld(mousePoint.x, mousePoint.y); if (m_overlay) { applyCurrentCommand(evt); return true; } for (Ship s : m_world.getShips()) { if (s.intersects(pt, m_camera)) { handleSelecti...
ce05d94a-421a-42a3-a7d9-926754022229
6
public static void main(String... args) { try { CA ca = new CA(); ca.startup(); int choice; while (true) { printCAMenu(); choice = choose(" >> ", 0, 1); switch (choice) { case 1 : System.out.println...
69c0f443-8758-4f76-a019-8d7dd106ec7a
5
public void removeItemAmount(String ttype,int ccount){ for (int i = 0;i<fullCount;i++){ if(items.get(i).type.equals(ttype)){ if(items.get(i).count>=ccount){ items.get(i).count-=ccount; ccount=0; if(items.get(i).count<=0){ ...
5da33e47-ed00-4095-9605-6287f84ddfb8
9
private void btnSalvarAlteracaoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnSalvarAlteracaoActionPerformed if (txtNomeProjeto.getText().equals("") || txtDescricaoProjeto.getText().equals("") || txtDataInicio.getText().equals(" / / ") || txtDataTermin...
c7a8f366-0537-42d5-a110-b781480f48d8
0
public ExpressionChangeEvent(RegularExpression expression, String old) { super(expression); this.expression = expression; this.old = old; }
b8ad9b4f-15d9-489e-a546-1ea56826e9a1
7
protected void keyTyped(char par1, int par2) { if (par2 == 200) { this.editLine = this.editLine - 1 & 3; } if (par2 == 208 || par2 == 28) { this.editLine = this.editLine + 1 & 3; } if (par2 == 14 && this.entitySign.signText[this.editL...
fb6e6743-7a0d-4c47-8679-7dae447d6014
0
public String getCondition() { return condition; }
ea62c98f-7809-4273-87ac-f1f7613c058c
4
public boolean isFilled() { return !(host.isEmpty() || ts.isEmpty() || path.isEmpty() || region.isEmpty() || s.isEmpty()); }
f387f91e-8a7f-4b06-a13a-3a7226a991e0
2
public void update(){ if(this.alive){ if(this.blink){ this.aux = blink(this.alpha); } } else{ this.aux = 255; } }
c6ee0dbb-d696-4e81-8aa5-a08166d6d908
8
public static boolean isBrother(MOB target, MOB observer, boolean nameOnly) { if((observer==null)||(target==null)) return false; if(!nameOnly) { if((observer.getStartRoom()!=null)&&(target.getStartRoom()!=null)) { if (observer.getStartRoom() == target.getStartRoom()) return true; } } if(...
3d5a9fa8-e94a-41b4-9015-c5bdc6e0dd6f
4
public void abortWarmUp(Player player) { if(null != player) { if(playersOnWarmup.containsKey(player.getName())) { // check if warm-up is still running for this player if(null != playersOnWarmup.get(player.getName())) { // cancel players...
0e95d2be-cbca-4f55-b26d-d4e6bf34907e
1
public void removePropertyChangeListener(PropertyChangeListener listener) { this.rosterChangeSupport.removePropertyChangeListener(listener); for (Roster r: rosters) { r.removePropertyChangeListener(this); } }
c98228b9-ea42-4c17-97be-ffca281f8dcc
5
public static void main(String[] args) { Cases[] cases = Cases.values(); int size = cases.length; for(int i = 0; i < size; ++i) { // If remove break statements, all downcases will be executed switch(cases[i]) { case FIRST_CASE: System.out.print...
7f31db14-d0a5-436c-a377-ebe98595d586
0
public void setCreatedAt(final Long createdAt) { this.createdAt = createdAt; }
9e072a20-7e39-403d-8883-b677b3b6beae
5
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; Location other = (Location) obj; if (x != other.x) return false; if (y != other.y) return false; return true; }
ec97acb4-2848-4ded-a215-bf89c5b3e078
3
public provinceInfo getProvince(String world, int x, int z) { // String together=x+"+"+z; String together = world + "+" + x + "+" + z; if (provinceLocCache.containsKey(together)) return getProvinceByID(provinceLocCache.get(together)); provinceInfo province = null; String SQL = "SELECT * FROM `Monarchy_Pr...
2102866d-e511-4486-991f-d253027c98fc
9
@Override public double[] calculateJulia3DWithoutPeriodicity(Complex pixel) { iterations = 0; double temp = 0; Complex[] complex = new Complex[2]; complex[0] = new Complex(pixel); complex[1] = new Complex(seed);//c Complex zold = new Complex(); Complex zold2...
f02e05ff-ca5c-474f-af09-e90ecbaa6b74
1
public static boolean isFull(){ if(questLog.size() == maxSize) return true; return false; }
8444fc5b-6919-4106-bcf9-1f83d0dd9940
5
@Override public boolean equals(Object obj) { if (this == obj) return true; if (!super.equals(obj)) return false; if (getClass() != obj.getClass()) return false; DirectedSceneNode other = (DirectedSceneNode) obj; if (Float.floatToIntBits(angleXZ) != Float .floatToIntBits(other.angleXZ)) retur...
473aa934-e5aa-48ef-a4d0-2372e696b31d
8
public void processQueue(int time, Simulator sim) throws VehicleException, SimulationException { archiveQueueFailures(time); final int tempQueueSize = vehiclesInQueue.size(); Vehicle v; endLoop: for (int i = 0; i < tempQueueSize; i++) { v = vehiclesInQueue.get(0); if (!v.isQueued()) { throw new V...
f525c9ce-1544-46ed-be7e-a4ba05995337
0
@Override protected final void configure() { checkState( jobListeners == null, "Re-entry is not allowed." ); checkState( triggerListeners == null, "Re-entry is not allowed." ); checkState( schedulerListeners == null, "Re-entry is not allowed." ); checkState( schedulerConfiguratio...
a9f7c623-a2ab-4898-b9e4-91f063a54313
7
* @return A list of FoundingFathers. */ public List<FoundingFather> getRandomFoundingFathers(Random random) { // Build weighted random choice for each father type Specification spec = getGame().getSpecification(); int age = getGame().getTurn().getAge(); EnumMap<FoundingFatherTyp...
40d10619-448b-411d-9b39-cbe930c6c836
6
public static String escape(String string) { char c; String s = string.trim(); StringBuffer sb = new StringBuffer(); int length = s.length(); for (int i = 0; i < length; i += 1) { c = s.charAt(i); if (c < ' ' || c == '+' || c == '%' ...
0e2a5902-88cf-4967-a978-e9b959193fb1
6
@Override public void setValueAt(Object o, int row, int col) { StockItem s = info.get(row); switch (col) { case 0: s.getChargeNo(); break; case 1: s.getMaterial().getName(); break; case 2: s.getCoilType().getThickness(); break; case 3: s.getLen...
ee12e43e-af58-46d6-9d58-5d145a44e32e
3
public void run() { try { ObjectInputStream in = new ObjectInputStream(clientSocket.getInputStream()); DataOutputStream out = new DataOutputStream(clientSocket.getOutputStream()); Object object = in.readObject(); MigratableProcess process = null; if(object instanceof MigratableProcess)...
c4e27e9a-a49a-40dc-b819-5462ea5afacf
9
private void processFullDictionary(OMMMsg msg, Handle handle) { String dictName = msg.getAttribInfo().getName(); System.out.println(_className + ".processFullDictionary: Receive full dictionary of " + dictName); if (msg.getDataType() != OMMTypes.SERIES) { ...
a0c56526-0ca4-4da9-9980-b3226ea3b09b
2
public static byte[] copyOf(byte[] original, int newLength) { if (newLength < 0) throw new NegativeArraySizeException("The array size is negative."); byte[] newArray = new byte[newLength]; if (newLength > original.length) { System.arraycopy(original, 0, newArray, 0, original.length); ...
638514e7-945c-40ee-a43d-175601d4a347
6
final synchronized public void set(final int index, final Number value) throws Exception, IndexOutOfBoundsException { switch (type) { case BOOL: case SINT: data.put(type.element_size * index, value.byteValue()); break; case INT: data.putSho...
be7c24aa-b1a8-439c-a0fc-ab25ba34d089
0
public void setModifyAuther(String modifyAuther) { this.modifyAuther = modifyAuther; }
99f218a8-5726-4b03-b814-2705e4224354
5
@Override public void onEnable(){ plugin = this; plugin.getConfig().options().copyDefaults(true); saveConfig(); plugin.reloadConfig(); hostname = "http://api.minetrends.com"; //hostname = "http://192.168.1.33"; refreshConfig(); //Check if a new update is available. if (plugin.getConfig().get...
36640fca-44ef-422b-a3c3-2d64777a9947
7
private void sarsa(int reward, Weights weights, double x_i[], double[] x_ip1) { // Set some local variables. double[] w = weights.getWeights(); double wx = 0.0f; double sig = 0.0f; // Compute y_i. double wxp1 = 0.0f; for (int j = 0; j < FeatureExplorer.getNumFeatures(); j++) wxp1 += w[j] * x_ip1[j]; d...
a67dfd92-a94c-4ee4-95b8-27c4d2a2ed52
1
private void checkEnd() { if (end) { throw new IllegalStateException( "Cannot call a visit method after visitEnd has been called"); } }
e0cd00c6-e8c7-408b-9158-55453e5ecb87
5
@Test public void testDeleteBook() { Connection conn = null; Statement st = null; ResultSet rs = null; try { conn=DriverManager.getConnection("jdbc:mysql://localhost:3306/librarysystem?user=admin&password=123456"); st=conn.createStatement(); //Delete any test books assertTrue(bh.deleteBook(-1)); ...
72c9fc91-9dea-4a34-9f18-f7266911a621
6
public void setGridGraphSpacing(mxAnalysisGraph aGraph, double xSpacing, double ySpacing, int numColumns, int numRows) { mxGraph graph = aGraph.getGraph(); if (xSpacing < 0 || ySpacing < 0 || numColumns < 1 || numRows < 1) { throw new IllegalArgumentException(); } Object parent = graph.getDefaultParent(...
aa022463-ce5a-48ef-8858-59b234988f92
9
public void destroy(Integer id) throws IllegalOrphanException, NonexistentEntityException, RollbackFailureException, Exception { EntityManager em = null; try { utx.begin(); em = getEntityManager(); TestcaseEntity testcaseEntity; try { testc...
7e38e21a-800a-4def-9dab-df03c868ae21
4
@Override public boolean applyBackup() { if (!Files.exists(Constants.SYSTEMFILE_AUTHUI_BAKPATH, LinkOption.NOFOLLOW_LINKS) || !Files.exists(Constants.SYSTEMFILE_BASEBRD_BAKPATH, LinkOption.NOFOLLOW_LINKS)) { return false; } boolean ret = true; try { //Co...
2474635b-6cba-4e47-83b9-17fd30e0ee6e
8
public void run() { if (!isActive() || !isRunning() || thumbnailGraphics == null) return; int v = getCurrentVTile(); int sy1 = v * tileSize.height; int sy2 = Math.min((v + 1) * tileSize.height, getSourceRectangle().height); int h = getCurrentHTile(); int sx1 = h * tileSize.width; int sx2 ...
5b793fff-2a8f-4f1a-9a45-baef2dd70c77
6
@Override public String toString() { StringBuilder b = new StringBuilder(NEW_LINE+indent); b.append(Modifier.toString(modifier)); b.append(" "); //generics if (generics.size() > 0) { b.append("<"); String prefix = ""; for (String generic : generics) { b.append(prefix); b.append(generi...
db6df082-785c-4b1e-b568-c3aee1e9552c
1
@Override public void addComponent(AbstractComponent component) throws ComponentException { if (component == null) { throw new ComponentException("Component is null"); } components.add(component); }