method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
0d1f6129-2e89-4d59-9d15-8efda38ff1e4
1
public String showListInKind(){ if(page == 0) page = 1; size = 5; List<Problem> list = problemDAO.findKindPage(page, size, kind); problemList = new ProblemList(); problemList.setList(list); return SUCCESS; }
834e4d47-8c02-47ad-bd6b-0be783f4bb29
0
@RequestMapping("/{producto}/cantidad/{cantidad}") public ModelAndView agregarStockAProducto( @PathVariable String producto, @PathVariable Integer cantidad) { Stock stock = Stock.getInstance(); stock.agregarStock(producto, cantidad); Integer availableStock = stock.obtenerStockDisponible(producto); Mod...
07b41b98-d23e-42e8-8918-70bc0d8d76a6
0
public String getNAME() { return name; }
d50be2f8-2f93-4b7f-be4e-6c81bbb5d935
2
@Override public boolean update(Object item) { conn = new SQLconnect().getConnection(); String sqlcommand = "UPDATE `Timeline_Database`.`Eventnodes` SET `description`='%s' WHERE `id`='%s';"; if(item instanceof Eventnode) { Eventnode newitem = new Eventnode(); newitem = (Eventnode)item; try { ...
3df4f998-7d81-4c1e-883e-4e1ef027bf25
6
public static String unescape(String string) { int length = string.length(); StringBuffer sb = new StringBuffer(); for (int i = 0; i < length; ++i) { char c = string.charAt(i); if (c == '+') { c = ' '; } else if (c == '%' && i + 2 < length) { ...
dee1da02-8c7f-4a67-b0d7-be9ca90f0dc4
6
public static Integer valueOf(Object o) { if (o == null) { return null; } else if (o instanceof Byte) { return (int)(Byte)o; } else if (o instanceof Integer) { return (Integer)o; } else if (o instanceof Double) { return (int)(double)(Double...
39193a51-38a7-4606-9bf6-769bfb4356ad
7
public Container load(InputStream is) throws FormatException, IOException { byte[] magic = new byte[4]; int bytesRead = is.read(magic); if (bytesRead < 4 || magic[0] != 0xF0 || magic[1] != 0x9F || magic[2] != 0x99 || magic[3] != ...
a2a6ee96-f733-44e2-b159-8c47b18a8256
0
public Gem removeGem() { tempGem = (Gem) Bag.get(0); this.Bag.remove(0); return tempGem; }
f82a8b95-3370-467d-8d81-a2dcc7ecd475
8
public static boolean attempt(BufferedReader input, BufferedWriter output, Scanner sc) throws IOException { output.write("HELLO\n"); output.flush(); String s, t; s=input.readLine(); if(!s.equals("HELLO. WHO ARE YOU?")){ System.out.println("PROTOCOL FAILED"); input.close(); output.close(); return ...
dac148d5-a2ad-407b-859e-0b7b795da31a
4
public Contact getLeastRecentlySeenBucketContact() { final Contact[] leastRecentlySeen = new Contact[]{ null }; contacts.traverse( new Cursor<NodeId, Contact>() { public SelectStatus select(Map.Entry<? extends NodeId, ? extends Contact> entry) { ...
e1f51059-951b-4e01-90b5-3a99855347a3
0
@FXML private void handleBtnNextAction(ActionEvent event) { move(1); }
141b28a6-84a4-43ea-a9da-4c653273d223
8
public void setTab(GraphicsTab tab) { Control[] children = tabControlPanel.getChildren(); for (int i = 0; i < children.length; i++) { Control control = children[i]; control.dispose(); } if (this.tab != null) this.tab.dispose(); this.tab = tab; if (tab != null) { setDoubleBuffered(tab.getDoubleBuffered()); ...
c387dfad-44ff-4a94-9be2-7463f07ed953
2
@Override public Converter put(String key, Converter value) { Converter v = super.put(key, value); if (v != null) { throw new IllegalArgumentException("Duplicate Converter for " + key); } return v; }
b4dcf09e-8faf-4803-b054-98b0f16b8b56
6
public static void main(String[] args) { if (args.length < 1) { System.out.println("Usage: java -cp .:sam.jar TabixReader <in.gz> [region]"); System.exit(1); } try { TabixReader tr = new TabixReader(args[0]); String s; if (args.length == 1) { // no region is specified; print the whole file whil...
0d998ee0-4971-46ee-9e1d-81f3fc94db86
7
private static void checkFeature (String id, XMLReader producer) { int state = 0; try { boolean value; // align to longest id... final int align = 35; for (int i = align - id.length (); i > 0; i--) System.out.print (' '); System.out.print (id); System.out.print (": "); ...
b43a31a0-597c-4ef3-bfbe-258f3c01a532
2
private void evalNewObjectArray(int pos, CodeIterator iter, Frame frame) throws BadBytecode { // Convert to x[] format Type type = resolveClassInfo(constPool.getClassInfo(iter.u16bitAt(pos + 1))); String name = type.getCtClass().getName(); int opcode = iter.byteAt(pos); int dimen...
a1c04014-22a8-4fb4-91b3-ea2c804902fe
3
public State getCorrespondingStoppedState() { if(state == State.MOVE_DOWN) { return state.STOPPED_DOWN; } else if(state == State.MOVE_LEFT) { return state.STOPPED_LEFT; } else if(state == State.MOVE_RIGHT) { return state.STOPPED_RIGHT; } else { return state.STOPPED_UP; } }
7cbca267-c1a4-464d-86bf-c50b508d722f
0
@Override public String toString() { return "ModelFiledDesc [filedName=" + filedName + ", filedType=" + filedType + ", tableFiledName=" + tableFiledName + "]"; }
dc08c2da-b4de-4051-9fa0-8a014751b752
4
private int pathFind(Pos start, int danger) throws Exception { // ArrayList<String> sTypes; // for(int i = 1; i < 5; i++) // { // for(int j = 1; j < 5; j++) // { // //just debugging to see the map and how it is represented from prolog // sTypes = ...
f0dc02a4-1fc2-495b-85c0-5d3b1b097108
9
@Test public void testAddBook() { Set<StockBook> booksToAdd = new HashSet<StockBook>(); Integer testISBN = 100; booksToAdd.add(new ImmutableStockBook(testISBN, "*@#&)%rdrrdjtIHH%^#)$&N 37874\n \t", "eurgqo 89274267^&#@&$%@&%$( \t", (float) 100, 5, 0, 0, 0, false)); List<StockBook> listBooks = null...
cff075f8-e218-461c-b443-ba7ca4bc25ad
0
public int getId(){ return id; }
c1f3d4ab-fab3-40f5-b60f-da0cadd4c094
1
public SignatureVisitor visitParameterType() { endFormals(); if (!hasParameters) { hasParameters = true; buf.append('('); } return this; }
4a8c58e3-4d66-4312-ac61-f54c8d76c30c
8
public static String cleanURL(String url) { if (isEmpty(url)) return ""; ArrayList<String> tmp=Functions.explode(", ",url); url=tmp.get(0); if (tmp.size() == 2 && Functions.strlen(tmp.get(1)) < 4) url = url + "," + tmp.get(1); ArrayList<String> replace = new ArrayList<String>(); replace.add("\n"); replace...
1a38ab3b-9d88-4272-873f-653a9f258e8f
6
public static void cppOutputAtomicExpression(Stella_Object atom) { { GeneralizedSymbol testValue000 = ((GeneralizedSymbol)(atom)); if (testValue000 == Stella.SYM_STELLA_NEWLINE) { ((OutputStream)(Stella.$CURRENT_STREAM$.get())).nativeStream.println(); } else if (testValue000 == Stella.SYM...
53ad9c9a-4494-48e1-8835-36ddcf0416d8
8
public void decode( ByteBuffer socketBuffer ) { if ( !socketBuffer.hasRemaining() || flushandclosestate ) return; if ( DEBUG ) System.out.println( "process(" + socketBuffer.remaining() + "): {" + ( socketBuffer.remaining() > 1000 ? "too big to display" : new String( socketBuffer.array(), socketBuffer.posi...
df9e5a62-b0f7-4d7a-be52-4682f954088c
5
@Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; IntegerAggregate that = (IntegerAggregate) o; if (value != null ? !value.equals(that.value) : that.value != null) return false; return true; }
504a98c1-ebb0-4059-be37-fdb2fc462712
1
public static ListeDesMatchs getListeDesMatchs() { if(lm == null) { lm = new ListeDesMatchs(1); return lm; } return lm; }
952e93e8-07ca-468c-aa8c-14ef29f38949
5
public static void main(String[] args) { Scanner scan = new Scanner(System.in); String input = null; int[] count = new int[VOWELS.length]; int y = 0; try { System.out.print("Enter a string to check for vowels: "); input = scan.nextLine().toLowerCase(); ...
fc206cca-e73d-4df0-a6fb-16c1521d5ee0
4
@Override public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception { HandlerMethod handlerMethod = (HandlerMethod) handler; Method method = handlerMethod.getMethod(); DoubleSubmitSession annotation = method.getAnnotation(Do...
e712bc64-18df-4628-ae9e-517e41227920
2
@Override public Auction bid(String username, int itemId) { searches.get(searches.get(itemId)); for(Auction auc : searches.values()){ if(searches.get(itemId) != null){ auc.setCurrentBid(auc.getCurrentBid()+1); auc.setOwner(username); return auc; } } return null; }
ebda8f81-3f78-40c5-8ca9-d030ea72c9ae
2
@Override public void run() { while(true) { try { System.out.println("Fps: " + fps); fps = 0; Thread.sleep(1000); } catch (InterruptedException e) { // TODO Auto-generated catch block e.printStackTrace(); } } }
65bb30df-5a64-43e4-94ec-1dea6cc17d5c
8
private void placeIdentityDiscNearPlayer() { for (Player p : grid.getAllPlayersOnGrid()) { boolean placed = false; int minX = (p.getPosition().xCoordinate > 1) ? p.getPosition().xCoordinate - 4 : 0; int maxX = (grid.width - p.getPosition().xCoordinate > 1) ? p.getPosition().xCoordinate + 4 : grid.width; ...
109e81b4-8877-4acb-a0ff-e59d2a1d7f25
7
private static void collideFixed( Sprite A , Sprite B , float ddx , float ddy ) { // j - для "запрыгивания" на уступы if( ddx>ddy || (A.j>0 && ddy<A.j) ) { if( A.y>B.y ){ A.y+=ddy; } if( A.y<B.y ){ A.y-=ddy; } } else { if( A.x>B.x ){ A.x+=ddx; } if( A.x<B.x ){ A.x-=ddx; } } /* if( ddx<ddy ) { if( A.x...
973d115d-c768-4359-a5a9-7cd9732f27aa
2
public void transformMouseEvent(MouseEvent event) { if (transformNeedsReform) reformTransform(new Rectangle(getSize())); Point point = new Point(), ePoint = event.getPoint(); try { // transform.transform(ePoint, point); transform.inverseTransform(ePoint, point); event.translatePoint(point.x - ePoint.x...
1d956e19-cd97-47c1-92bf-8ce96ff16d01
3
@SuppressWarnings("deprecation") @Override public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) { if(Match.getMatch().getState().equals(MatchState.PREMATCH)){ for(Player player : Bukkit.getOnlinePlayers()){ Match.getMatch().getSurvivors().add(player); } if(Match.g...
426f442e-0ec3-41b9-b26c-b944350b87c8
2
public Vector2 calculate(Vector2 target) { Vector2 steeringForce = new Vector2(0f, 0f); for(MovingEntity neighbor : minigame.birds) { if(neighbor != entity) { Vector2 toAgent = entity.position.minusOperator(neighbor.position); toAgent.normalize(); toAgent = toAgent.divideBy(toAgent.length()); ste...
a9a73876-7f5b-4281-825e-3cdf5b135936
2
private List<String[]> getCustomOutputsPropertyValue(final Properties properties) { List<String[]> customOutputs = new ArrayList<>(); String values = this.getPropertyValue(properties, CUSTOM_OUTPUTS_TAG, null); if (values == null) { return null; } String [] outputs = values.split(OUTPUT_SEPARATOR); for (...
ee0aa148-01f3-4016-96e7-2ea37ce35738
3
public void run() { HttpURLConnection var1 = null; try { URL var2 = new URL(this.location); var1 = (HttpURLConnection)var2.openConnection(); var1.setDoInput(true); var1.setDoOutput(false); var1.connect(); if(var1.getResponseCode() / 100 == 4) { ...
5e312a76-cee9-4784-a0a4-13ec5295382f
4
private static int[][] calculateDistances2(double[][] points,int N) { int[][] distanceMatrix= new int[N][N]; for(int i=0; i<N;i++){ for(int j=0;j<N;j++){ if(j==i){ distanceMatrix[i][j]=0; } else if(i<j){ distanceMatrix[i][j]=distance(points[0][i],points[0][j],points[1][i],points[1][j]); } e...
c9382762-2189-41ad-8288-37557c1cf1d7
3
public static void main(String[] args) { // TODO Auto-generated method stub Scanner sc = new Scanner(System.in); int[] numbers = new int[3]; for (int i = 0; i < numbers.length; i++) { numbers[i] = (int) (Math.random() * 10); for (int j = 0; j < i; j++) { if (numbers[i] == numbers[j]) { i--; ...
bb19e551-f2ab-4af4-8384-d31a9ca8d71b
8
public ArrayList<BedFeature> getBedData(RPChromosomeRegion selectionRegion, boolean contained) { int itemNumber = 0; int chromID, chromStart, chromEnd; String restOfFields; int itemHitValue; // chromID + chromStart + chromEnd + res...
e3790164-3354-45d1-adae-00f8efac8310
9
@Override public Provider matchClientProviders(Task task, List<Provider> providers) { Client ci = task.getClient(); Cluster cu = ci.getBelongingCluster(); Provider matched = null; double matchedScore = Double.NEGATIVE_INFINITY; // test providers randomly Lis...
25d22aa7-bf9e-47b3-ad78-c599d41cf8be
2
public void drawPredator(Node to, Node from, Graphics g) { if (from != null) { Coordinates predatorCoords = from.getCoordinates(); int predPicX = predatorCoords.col * wallSize + padding + finalFormatX - (wallSize / 2) + 2; int predPicY = predatorCoords.row * wallSize + padding + finalFormatY - (wal...
3be89554-2033-4414-a656-cd42ea36e80f
1
public final Object get(String key) throws JSONException { Object o = opt(key); if (o == null) { throw new JSONException("JSONObject[" + quote(key) + "] not found."); } return o; }
973dee76-9952-4ae4-ac6a-8723cf573a44
2
@Override public int compareTo(Hand o) { currentType = Validator.getHandType(this); Hand h = new Hand(this); Collections.sort(h.getCards()); return currentType.getValue() > o.getCurrentType().getValue() ? -1 : currentType.getValue() < o.getCurrentType().getValue() ? 1 : 0; }
165c4276-5f1f-4e03-a69d-bc08c489e8dd
9
public void act(int timestamp) { //Do actions, then check fuel levels at end of tick if (currentLocation instanceof Hangar) { Simulation.getStatistics().incrementNumberOfTakeOffs(this); takeOff(timestamp); } else if (currentLocation instanceof Airspace) { Simulation.getStatistics().incrementNumbe...
84b98216-055c-4106-8672-1a222bd6082d
8
public static void processDownlaod(ModInstance modInstance) throws IOException { File currentMod = new File(FileManager.dir + "/" + modInstance.type.output + "/", modInstance.modName); File storedMod = new File(FileManager.updaterDir + "/" + modInstance.type.storage + "/", modInstance.modName); ...
3a7206fe-794c-4495-8e9c-273e1af199b5
2
public void dfs(Vertex<T> start) { //DFS uses Stack data structure Stack<Vertex<T>> stack =new Stack<Vertex<T>>(); start.visited=true; stack.push(start); printNode(start); while(!stack.isEmpty()) { Vertex<T> n= stack.peek(); Vertex<T> child=getUnvisitedChildren(n); if(child!=null) { c...
c4f7c386-9959-439e-b745-2c7bf3c7834c
0
public void removeChangeListener(ChangeListener listener) { changeListeners.remove(listener); }
b67dad37-7221-4978-a1ec-9b215b6415f6
4
public ListNode partition(ListNode head, int x) { ListNode p1 = null, p2 = head, p2Prev = null; while( p2 != null ) { if( p2.val < x ) { if( p1 == p2Prev ) { p1 = p2; p2 = p2.next; p2Prev = p1; } el...
51c2b1c7-230f-45d3-add0-37d1afd4c9d1
8
private boolean onCommandRefresh(CommandSender sender, Command command, String label, String cmd, String[] args) { String queryPlayerName = getQueryPlayerName(sender, args, 1); if (!queryPlayerName.equals("CONSOLE")) { Hashtable<String, ReplicatedPermissionsContainer> playerMods = null; for (Entry<Stri...
b821423c-eae5-41f0-b332-7b0731ec538b
4
public void step() { double x0 = x, y0 = y, t0 = t; x += v * Math.cos(t) * dt; y += - v * Math.sin(t) * dt; t += vt * dt; while (t < - Math.PI) t += 2 * Math.PI; while (t >= Math.PI) t -= 2 * Math.PI; if (playfield.collision(this, true)) { ...
875ab3fd-ec9e-4034-8efd-9baf3e1d3da6
0
public String getBlogContent() { return this.blogContent; }
879048f5-3a34-4fe1-90e8-9f5c50ef4a2e
3
private static int getBits(int i, Bzip2Block bzip2Block) { int dest; do { if (bzip2Block.bsLive >= i) { int tmp = bzip2Block.bsBuff >> bzip2Block.bsLive - i & (1 << i) - 1; bzip2Block.bsLive -= i; dest = tmp; break; } bzip2Block.bsBuff = bzip2Block.bsBuff << 8 | bzip2Block.input[bzip2Block....
e61cbfca-1eeb-42cb-86f0-41416200537a
6
public boolean move() { // Don't let him move out of bounds. /*if ( (position.x + WIDTH + direction.x > Map.WIDTH) || (position.x + direction.x < 0) || (position.y + HEIGHT + direction.y > Map.HEIGHT) || (position.y + direction.y < 0)) return;*/ if (position.x + WIDTH + direction.x > Map.WIDTH) ...
98dac331-b799-4126-97e5-aeacdff393ae
3
@Override public boolean offer(T t) { boolean result = false; if (firstItem == null) { firstItem = new LinkedItem(t); result = true; } else { boolean searching = true; LinkedItem currentItem = firstItem; LinkedItem lastItem = null; while (searching) { if (currentItem.getNextItem() == null)...
071275ce-f555-4ebe-8fa8-b7c261ae34bc
2
@Override public Set<List<A>> times(Set<List<A>> x, Set<List<A>> y) { Set<List<A>> product = new HashSet<>(); for (List<A> a : x) { for (List<A> b : y) { product.add(concat(a, b)); } } return product; }
b1a49d10-53d7-4550-ad4d-fef2478b0326
7
public void run() { Date date = new Date(); Calendar cal = Calendar.getInstance(); cal.setTime(date); String time = cal.get(Calendar.HOUR_OF_DAY) + ":" + roundUpToNearestFive(cal.get(Calendar.MINUTE)); System.out.println("COLLECTING RENT."); DBConnector dbc = _plugin.db; List<World> worlds = Bukkit.getWor...
9e6b6e44-a503-4ab5-89b3-25ce9e1a8206
4
public SimpleRunCPE(String args[]) throws Exception { mStartTime = System.currentTimeMillis(); // check command line args if (args.length < 1) { printUsageMessage(); System.exit(1); } // parse CPE descriptor System.out.println("Parsing CPE Descriptor"); CpeDescription cpeDesc =...
afa9a8a3-061a-4048-b7c7-93a103b8b74f
9
private void serveGet(List<String> request) throws IOException, ClassNotFoundException, WrongVersionNumber{ if (request.size() < 3){ return; } boolean zip = (request.get(0) != null) && (request.get(0).equals("get_zip")); String source = request.get(1); List<Str...
9db5739c-ac97-4f2c-8128-b056e186557f
8
protected final CodSigningInfo signers(final InputStream inputStream, final String fileName) { // Pre-condition: - inputStream is not null - inputStream is at the // beginning of the file // Post-condition: - inputStream is at the end of the file, but still /...
b7513de4-d4f3-470a-87a3-70589110eebd
9
@Override public Resource objectToJena(Model toAddTo, Investigation investigation) throws IllegalArgumentException { if (investigation.getResourceURL() == null) { throw new IllegalArgumentException(String.format(msg_ResourceWithoutURI, "investigations")); } Resource res = toAddTo.createResourc...
2a924a6b-4dbf-4562-a732-9ede0f256ab7
7
public void writeToStream(PrintStream p) { // create definition string with first character 1 if the // mapping is character-defined, 0 otherwise String definition = "" + (characterDef ? 1 : 0); // add character or keycode definition += "\t"; if (characterDef) definition += (int) keyChar; else def...
d8cd4f1b-e090-4303-94ee-cd719d493591
7
@Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; NodePair nodePair = (NodePair) o; if (finish != null ? !finish.equals(nodePair.finish) : nodePair.finish != null) return false; if (start != null ? !start.equals(n...
ae5bbd4f-f779-4f56-bf4e-1f9f920bee43
1
public boolean containsValidLoginDetails() { return isValidPassword() && isValidEmail(); }
2731d1c2-c814-4a75-aba0-b5d0fe07847a
5
@Override public void run() { long previousTime = System.currentTimeMillis(); long currentTime = previousTime; if( soundSystem == null ) { errorMessage( "SoundSystem was null in method run().", 0 ); cleanup(); return; } ...
756d4380-6d65-4d21-9a64-c27897d3d686
8
@Override public String toString() { String str = ""; if (isFlag(DRIVE_READY)) str += "DRIVE_READY "; if (isFlag(MOTOR_OFF)) str += "MOTOR_OFF "; if (isFlag(MOVING)) str += "MOVING "; if (isFlag(VOLTAGE_FAULT)) str += "VOLTA...
9bb8b0f8-fedc-45e6-bb49-9e4e971cbd21
0
@Override public void windowClosing(WindowEvent e) { kaModel.saveToFile(dataFile); }
f2ee80ea-debb-4483-96d2-f3af2cce420a
5
public void startPolling() { pollingActive = true; Runnable pollingTask = () -> { while(pollingActive) { //wait for a bit try { Thread.sleep(2000); } catch (InterruptedException e) { e.printStackTrace();...
dd5f0b80-90e8-44db-92f8-1b4e39302491
1
public void extractEmails(String input){ String emailRegex = "[A-z0-9_.]+@[A-z0-9_.]+([.com]|[.net]|[.edu])"; // String emails = "someone@this.com, that one guy, realEmail@k.edu"; //extracts email addresses from email message // [A-z0-9_.]+@[A-z0-9_.]+([.com]|[.net]|[.edu]) p = Pattern.compile(emailRegex); ...
69fe9fca-ceb9-4fad-826c-03780d1e681f
1
public boolean conditionMatches(CombineableOperator combinable) { return (type == POSSFOR || cond.containsMatchingLoad(combinable)); }
12e40f11-2a46-4606-94dd-7bcd397a0e16
8
public static void dswap_j (int n, double dx[], int incx, double dy[], int incy) { double dtemp; int i,ix,iy,m; if (n <= 0) return; if ((incx == 1) && (incy == 1)) { // both increments equal to 1 m = n%3; for (i = 0; i < m; i++) { dtem...
b193cd16-49cf-43d4-b49a-55f3f42a0465
0
public VDGTransitionCreator(AutomatonPane parent) { super(parent); }
cf9a058b-2e4a-45d9-a059-32d11428f48f
7
public int lengthOfLastWord(String s) { if (s == null || s.length() == 0) { return 0; } int lastWordEnd = -1; for (int i = s.length() - 1; i >= 0; i --) { char c = s.charAt(i); if (c == ' ') { if (lastWordEnd != -1) { ...
1bf7b154-190b-45e5-9f2a-410bd863d084
0
@Override public void setResource(String resource) { this.resource = resource; }
7e08d161-c4ae-46a8-abb6-9cdbc53090ff
0
private XMLTools() {}
5e4de7ec-4126-4601-aa22-60ab54200795
7
String multiplyHelper(String str1,int digit,int zeros){ if(digit==1){ for(int i=0;i<zeros;i++){ str1+="0"; } return str1; } if(digit==0||str1.equals("0")){ return "0"; } String str=""; int advance=0; for(int i=str1.length()-1;i>=0;i--){ int temp=(str1.charAt(i)-'0')*digit+advance; ad...
3fe5fb73-e87c-41e4-8ea2-4a6a74ed4e95
5
public void generatePath(ArrayList<ArrayList<Integer>> result, ArrayList<Integer> path, TreeNode root, int sum) { path.add(root.val); if(root.left==null&&root.right==null){ if(root.val==sum){ result.add(new ArrayList<Integer>(path)); return; } ...
273dff86-3249-4616-8446-f82dca940718
6
@SuppressWarnings({"ToArrayCallWithZeroLengthArrayArgument"}) public void testKeySet() { int element_count = 20; int[] keys = new int[element_count]; String[] vals = new String[element_count]; TIntObjectMap<String> raw_map = new TIntObjectHashMap<String>(); for (int i = 0; i...
6c3b6889-a940-4d6a-9a13-ffdf743b23e8
3
public ArrayList<Rectangle2D> getAllBlockedBoxes() { if(noChildren()) { ArrayList<Rectangle2D> tempBoxes = new ArrayList<Rectangle2D>(); if(this.blocked) tempBoxes.add(this.box); return tempBoxes; } else { ArrayList<Rectangle2D> tempBoxes = new ArrayList<Rectangle2D>(); for(int x = 0; x < thi...
025dfe77-00bc-475f-a83e-ecfb07acb070
9
private final void method549(byte[] bs, int[] is, int i, int i_62_, int i_63_, int i_64_, int i_65_, int i_66_, int i_67_, int i_68_, int i_69_, int i_70_, aa var_aa, int i_71_, int i_72_) { aa_Sub1 var_aa_Sub1 = (aa_Sub1) var_aa; int[] is_73_ = var_aa_Sub1.anIntArray5487; int[] is_74_ = var_aa_Sub1.anIntArray548...
0e8295cf-113a-420f-a531-f92155776282
5
@Override public List func_22176_b() { ArrayList var1 = new ArrayList(); File[] var2 = this.field_22180_a.listFiles(); for(File var3 : var2) { if(var3.isDirectory()) { String var7 = var3.getName(); WorldInfo var8 = this.getWorldInfo(var7); if(var8 != nul...
db7cb126-65b1-4f10-b2f8-8c0c845b999d
3
public SignatureVisitor visitReturnType() { if (type != METHOD_SIGNATURE || (state & (EMPTY | FORMAL | BOUND | PARAM)) == 0) { throw new IllegalArgumentException(); } state = RETURN; SignatureVisitor v = sv == null ? null : sv.visitReturnType(); ...
8f7a61d5-7adf-44b6-becd-fc396f8ca7a3
1
private JButton createConfirmButton() { JButton b = new JButton("Confirm"); b.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { try { submitPurchaseButtonClicked(); } catch (ParseException e1) { e1.printStackTrace(); } } }); b.setEnabled(false); ...
a7a3b490-b49c-46a8-8f39-5bcbe2ddbe19
7
private static String js_substr(String target, Object[] args) { if (args.length < 1) return target; double begin = ScriptRuntime.toInteger(args[0]); double end; int length = target.length(); if (begin < 0) { begin += length; if (begin < 0) ...
babbc9d4-5b3d-408a-82a9-44e790700858
7
@Override public boolean equals(Object o) { if (this == o) return true; if (!(o instanceof TestBox)) return false; TestBox testBox = (TestBox) o; if (depth != testBox.depth) return false; if (height != testBox.height) return false; if (width != testBox.width) return...
1f4d154d-bf1c-4f76-8609-3913aa38879c
6
private void emitTableCRUD( Table table ) throws Exception { // Default array params for all rows ArrayList<String> params = new ArrayList<String>(); for ( Field row : table.fields ) { params.add( SqlUtil.getJavaTypeFor( row.type ) ); params.add( row.name ); } ArrayList<String> paramsWithUnique = n...
57f91d9c-0fa3-454f-97b9-8e5008981efb
1
public void stop_tunnel_in(final long milllis) { new Thread(new Runnable() { public void run() { try { Thread.sleep(2000); stop_tunnel(); } catch (Exception e) { } } }).start(); }
d14010f7-3fd5-4238-bc1f-50216a7f7e5d
5
@Override public void update() { switch(this){ case START_LEVEL: if(Game.level == null){ //game over... System.out.println("game over"); } Animation.START_LEVEL_ANIMATION.update(); break; case PLAY_LEVEL: Game.gameField.update(); break; case END_LEVEL: //keep the level playing in b...
e10af852-a993-46dd-9c4d-85886ace7b6d
6
public ArrayList<String> allowedActions(String asker,String type) { // access property looks like access_read = 'u(admin,daniel),a(euscreenpreview)' // where u=user,a=application etc etc. Any normal writes on 'access_ are forbidden. ArrayList<String> list = new ArrayList<String>(); // we do them one by one to b...
c91325e0-c745-4355-8e35-044de993cd24
4
public static boolean Checkkey (String s) { if ("fk".equals(s)||"Fk".equals(s)||"FK".equals(s)||"fK".equals(s)) { return true; } else { return false; } }
8ebd31ba-e853-45c3-88b8-2ef27b5ffc7a
2
public SpellList() { setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE); setTitle("Spell List"); setBounds(100, 100, 325, 500); getContentPane().setLayout(new BorderLayout()); contentPanel.setBorder(new EmptyBorder(5, 5, 5, 5)); getContentPane().add(contentPanel, BorderLayout.CENTER); contentPanel.setLayo...
370832e7-6154-4225-a0a2-ec88bb1f0852
7
protected boolean couldSwitch(Behaviour last, Behaviour next) { if (next == null) return false ; if (last == null) return true ; // // TODO: CONSIDER GETTING RID OF THIS CLAUSE? It's handy in certain // situations, (e.g, where completing the current plan would come at 'no // cost' to the ne...
fdb50e74-1457-4aa3-9e28-a0b74fe24ae8
8
private void botonMoverAdministrarCatalogoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_botonMoverAdministrarCatalogoActionPerformed if (this.campoOrigenAdministrarCatalogo.getText().equals("Origen") || this.campoDestinoAdministrarCatalogo.getText().equals("Destino")) { JOptionP...
a2b3eed9-5877-458d-a61d-b3252ef99c5c
4
public static void main(String[] args) { if (args.length<2) { System.out.println("Usage: Echo <host> <port#>"); System.exit(1); } ss = new EchoObjectStub2(); //EJERCICIO: crear una instancia del stub ss.setHostAndPort(args[0],Integer.parseInt(args[1])); BufferedReader stdIn = ...
56948058-cd3f-4e07-8f4e-eaf52694ecc8
0
public void back(int velocity) { controls.back(velocity); }
bed5f47e-330f-4442-bfd4-44f345abf0e3
9
public static void main(String[] args) { ArrayList<Integer> results = new ArrayList<Integer>(); int number = 1; do { int result = number; do { String parse = Integer.toString(result); char[] cheat = parse.toCharArray(); int suma = 0; for (int i = 0; i < cheat.length; i++) suma += Math....
d714fd12-cd96-49e1-a19f-30338d9eb689
4
@Override public void onCombatTick(int x, int y, Game game) { SinglePlayerGame spg = (SinglePlayerGame) game; List<Entity> neighbors = spg .getSquareNeighbors(x, y, 1); for (Entity entity : neighbors) { if (entity.id == zombie.id) { if (((MortalEnt...
dd0f3681-31f4-4f1a-997c-d0e8d449ebf3
5
private void update(DocumentEvent event) { String newValue = ""; try { Document doc = event.getDocument(); newValue = doc.getText(0, doc.getLength()); } catch (BadLocationException e) { e.printStackTrace(); } if (newValue.length() > 0) { int index = targetList.getNextMatch(...
848601e7-d358-4128-aa8b-29ad4c8bf444
2
public PlanBeschreibung(JSONObject setup, Object obj) throws FatalError { super("Beschreibung"); if (obj == null || ! (obj instanceof String)) { throw new ConfigError("Beschreibung"); } else { content = (String) obj; } }