method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
8c2fa28e-1d05-414a-8e58-b5f8e7fd06c8
5
public Boolean selectTests(Connection con, Triple t){ try{ ResultSet rs = con.select("SELECT ?s ?p ?o FROM <http://example.com> WHERE {?s ?p ?o} LIMIT 1"); int i =0; while(rs.next()){ if(! rs.getObject(1).toString().equals(t.getSubject().toString())) return false; if(! rs.getObject(2).toString()...
696ca957-d0fe-43eb-8861-2bb5cc4013b9
2
public void collectCallbackMethodsIncremental() { Transform transform = new Transform("wjtp.ajc", new SceneTransformer() { protected void internalTransform(String phaseName, @SuppressWarnings("rawtypes") Map options) { // Process the worklist from last time System.out.println("Running incremental callback ...
224adfa2-9b4f-4d2f-84a2-0c2a0ff1db58
3
@Override public void caseAThisHexp(AThisHexp node) { for(int i=0;i<indent;i++) System.out.print(" "); indent++; System.out.println("(This"); inAThisHexp(node); if(node.getThis() != null) { node.getThis().apply(this); } outAThisHexp(node);...
c3de657d-ad44-487f-b9b9-ca4a1232244f
8
public void findIndexUsageForPair(TablePairActivity tablePair) { for (Query query : queries) { List<String> queryRelations = query.getRelations(); Set<QueryFilter> queryFilters = query.getSelections(); String tableA = tablePair.getNameOfTableA(); String tableB = tablePair.getNameOfTableB(); if (table...
438ae5cd-d645-4034-8f7d-e0bdfdccccad
9
public static void main(String args[]) throws IOException { //Input server check System.out.println("Is this the server?"); Scanner sysIn = new Scanner(System.in); String inToken = sysIn.nextLine(); if(inToken.equalsIgnoreCase("yes")) { isServer = true; } else { isServer = false; } try { //Op...
f19e2f03-8f9c-4a58-bfcd-42c626b41e98
7
@Override public boolean add(E e) { setIn = new Node(e); Node previous = null; if(isEmpty()){ root = setIn; ant++; return true; } current = root; while(current != null){ if(setIn.object.compareTo(current.object)<0){ previous = current; current = current.right; }else if(setIn.object.c...
9bfb5ba7-f8ee-426e-9445-9bdbff74a45a
8
public static double[][] getInverse(double[][] A){ if(A.length != A[0].length) return null; if(getDet(A) == 0) return null; double T[][] = new double[A.length][A.length*2]; double I[][] = generateIdentity(A.length); for(int i = 0; i<A.length; i++){ for(int j = A.length; j<T[0].length; j++){ T[i][...
d14b5a2d-522a-4f66-9a52-272c480663d6
2
public static String trimFront(String text, String match, int numToTrim) { int substringStart = 0; for (int i = 0; i < numToTrim; i++) { if (text.startsWith(match, substringStart)) { substringStart += match.length(); } } return text.substring(substringStart, text.length()); }
7bf23cf9-cad9-48b4-b6a8-9f91b913e7f8
6
protected void quickSort(int low, int high, List<Player> players) { int i = low; int j = high; Hand pivot = players.get(low + (high - low) / 2).getHands().get(0); while (i <= j) { while (players.get(i).getHands().get(0).compareTo(pivot) < 0) i++; while (players.get(j).getHands().get(0).compareTo(piv...
6299491f-9c75-4c95-9436-3eef93132774
3
private void generateLabelledDescription() throws Exception { Description originalDescription = super.getDescription(); labelledDescription = Description .createSuiteDescription(originalDescription.getDisplayName()); ArrayList<Description> childDescriptions = originalDescription ...
1fd6a22a-82c4-4d6f-84fe-3cd166bd5407
3
public static void disposeall(GL gl) { Collection<Integer> dc; synchronized (disposed) { dc = disposed.get(gl); if (dc == null) return; } synchronized (dc) { if (dc.isEmpty()) return; int[] da = new int[dc.size()]; int i = 0; for (int id : dc) da[i++] = id; dc.clear(); gl.glD...
950751ae-f221-4026-a9ab-0d5fc6b7ad8b
3
public ListNode reverse(ListNode head) { if (head == null || head.next == null) return head; ListNode p = head.next; head.next = null; while (p != null) { ListNode nextP = p.next; p.next = head; head = p; p = nextP; } return head; }
8a020e27-4e24-457b-aba8-b5ead92558eb
8
private int jjMoveStringLiteralDfa5_0(long old0, long active0) { if (((active0 &= old0)) == 0L) return jjMoveNfa_0(0, 4); try { curChar = input_stream.readChar(); } catch(java.io.IOException e) { return jjMoveNfa_0(0, 4); } switch(curChar) { case 48: return jjMoveStringLiteralD...
e9f20234-625c-4166-a105-ca5089dfbaec
0
public int fight() { /*int damage = random.nextInt(maxDmg - (minDmg + 1)) + minDmg; if(random.nextInt(100) < this.luck) { System.out.println("Critical Attack!"); return (int) damage * 2; }*/ return (int) this.strength; }
9d638033-65d6-4753-a2f7-17434459f09b
6
private void createFictionalState() { State fictionalState = new State(states.length, false); for (Character ch : alphavet) { fictionalState.addNextState(ch, fictionalState); } boolean flag = alphavet.contains('e'); if (flag) { alphavet.remove('e'); ...
1b4a0def-7d3e-4bc8-ad67-9889402217be
7
public int getDistance() { // check preconditions int m = s1.length(); int n = s2.length(); if (m == 0) { return n; // some simple heuristics } else if (n == 0) { return m; // some simple heuristics } else if (m > n) { String tem...
a149a216-bd15-4b17-b089-4398b0291bd4
3
private void conditional() throws CompilationException { binOP(0); if (type==35) { // '?' int ecol=ct_column; nextToken(); int stackSizeBeforeBranch=paramOPs.size(); conditional(); consumeT(36); // ':' int stackSizeAfterFirstBranch=paramOPs.size(); condit...
2673ebad-40da-4c91-9b0e-c7eb4d19e3de
9
private void testAbstractMethods(ByteMatcher matcher) { // test methods from abstract superclass assertEquals("length is one", 1, matcher.length()); assertEquals("matcher for position 0 is this", matcher, matcher.getMatcherForPosition(0)); try { matcher.getMatcherForPositio...
cd6fd62f-646c-4723-8db3-5262557c527e
9
public void checkBanks() { try { File dir = new File("characters"); if(dir.exists()) { String read; File files[] = dir.listFiles(); for (int j = 0; j < files.length; j++) { File loaded = files[j]; if (loaded.getName().endsWith(".txt")) { Scanner s = new Scanner (loaded); int c...
7a982881-8505-4431-ab98-a6af5f203753
4
public boolean requestEnter(Story st){ boolean isTrueStory = building.getElevator().getCurrentStory().equals(dispatchStory); boolean isBoading = building.getElevator().getAction().equals(Actions.BOARDING); if (gui.isAborted()){ setTransportationState(TransportationState.ABORTED); return true; } el...
8226ec37-9023-4192-9f71-23ae134d9710
1
public boolean nemfoglalt() { if(sajat[hovaakar1][hovaakar2]==0) return true; logger.info("A lépés foglalt mezőre lépne!"); return false; }
c4638096-daeb-49d8-ba27-fbe7ee771518
0
final void init() throws IOException { receivingSocket = new MulticastSocket(4446); multicastAddre = InetAddress.getByName("230.0.0.1"); receivingSocket.joinGroup(multicastAddre); receiverThread = new MulticastReceiverThread(); sendSocket = new MulticastSocket(4446); ...
b2e337e5-0b12-4a03-83ae-13ea83e03d97
8
@Override public void setImages() { if (waitImage == null) { File imageFile = new File(Structure.baseDir + "BeachBetrayal.png"); try { waitImage = ImageIO.read(imageFile); } catch (IOException e) { e.printStackTrace(); } } if (attackImage == null) { // cannot attack File imageFile = new F...
76b84aa7-3799-4a10-9957-de342376bd46
6
public void update(GameContainer gcan, StateBasedGame state, int delta) throws SlickException { mx = Mouse.getX(); my = 720 - Mouse.getY(); Point t = mouseToIso(); isox = (int) t.getY(); isoy = (int) t.getX(); a.update(); b.update(); c.update(); d.update(); if(a.activated()) { Session...
e7905788-a85d-4aeb-a704-cad6632adb55
9
static final void method1252(int i, int i_2_, int i_3_, int i_4_, int i_5_, int i_6_, int i_7_, byte i_8_, int i_9_) { anInt2124++; if (!Class320.method2547(i_2_, (byte) 84)) { if (i_4_ == -1) { for (int i_10_ = 0; (i_10_ ^ 0xffffffff) > -101; i_10_++) Class152.aBooleanArray2076[i_10_] = true; ...
c99275db-4932-4d8e-9011-deb1993cbc96
0
public void setAgentColor(Color c) { agentColor = c; }
0920a41a-7bf3-4b7a-aa1e-ffee68959f86
0
public SimpleMultiReplacementFileContentsHandler(Vector matches, Vector replacements, String lineEnding) { super(lineEnding); setMatches(matches); setReplacements(replacements); }
0ee58d40-5936-424a-a502-0af24fa3a89e
6
public void keyPressed(KeyEvent e) { if (e.getKeyModifiersText(e.getModifiers()).equals("Alt")) { int arg = 0; try { arg = Integer.parseInt(e.getKeyText(e.getKeyCode())); } catch (NumberFormatException ex) { return; } switch (arg) { case 1: //settlement gameLogic._...
f360b7e6-75c3-47fd-bf28-02702475c55c
6
public List<String> parse(final String line) { final List<String> list = new ArrayList<>(); final Matcher m = csvRE.matcher(line); // For each field while (m.find()) { String match = m.group(); if (match == null) { break; } if (match.endsWith(",")) { // trim trailing , match = match.substrin...
378aecf4-b2c8-4721-be82-b9173035009c
9
private void doClear(button[][] mineButtons, int x, int y) throws Exception { System.out.println("x:" + x + " y:" + y); if (x < 0 || x >= 10 || y < 0 || y >= 10) { return; } button currButton = mineButtons[x][y]; if (!currButton.isEnabled()) { return; } currButton.setBackground(Color.lightGray); ...
ee4ee304-4302-4edb-8c70-ef3c8b6dbff3
9
private void internalDecompose(CharSequence source, StringBuffer target) { StringBuffer buffer = new StringBuffer(8); boolean canonical = (form & COMPATIBILITY_MASK) == 0; int ch32; //for (int i = 0; i < source.length(); i += (ch32<65536 ? 1 : 2)) { for (int i = 0; i < source.len...
3c4b3e91-8e01-4af0-9d6a-874e4054e762
9
public static boolean isValid(String IP){ IP = IP.trim(); if(IP.startsWith(".") || IP.endsWith(".")){ return false; } String[] ipArr = IP.split("\\."); if(ipArr.length == 4){ for(String str : ipArr){ if(str.length() >= 0 && str.length() <=3){ try { int val= Integer.pa...
6a064b61-b826-48ce-ab5d-ea092ea2a6dd
3
public URL getCodeBase() { if (Signlink.mainapp != null) { return Signlink.mainapp.getCodeBase(); } try { if (super.frame != null) { return new URL("http://127.0.0.1:" + (80 + Client.portOff)); // return new URL("http://ss-pk.no-ip.biz:" + ...
4e2ce816-86bd-4feb-a84c-411b862ff411
1
public Item getItem(){ Item item; if (originalItem==null) item=new Item(); else item=originalItem; item.setName(nameTextField.getText()); item.setDescription(descriptionTextField.getText()); item.setPrice(Integer.parseInt(priceTextField.getText())); item.setQuantity(Integer.parseInt(quantityTextField.ge...
3789dfa1-9e09-4e48-9b66-9c9378a5f6cc
4
private static void displayReviewVideo(BufferedReader reader, VideoStore videoStore) { try { System.out.println("Please enter the title of the video you want review:"); String isbn = getISBNFromTitle(reader, videoStore, reader.readLine()); if (videoStore.getOwnReviews(isbn, ...
b1d2e3f1-75ca-4b48-89f3-2c3bdfb2f948
1
@Override public void registerEvent(Class<? extends Event> clazz) { }
d0f755d6-1120-497c-a684-13cd5143aeb5
0
public String getEmail() { return email; }
3e07d284-a514-48a3-9bd1-cdfa01d5ec2d
5
void remove() { if ( left == null || right == null ) { if ( this.left != null ) this.left.right = this.right; if ( this.right != null ) this.right.left = this.left; if ( this == parent.diagonals ) parent.diagonals = ...
fe353532-1794-464b-bc22-07b95d939dd6
2
public static String trimSlashes(String s) { String temp = s; if (temp.charAt(0) == DELIMITER.charAt(0)) temp = temp.substring(1); if (temp.charAt(temp.length() - 1) == DELIMITER.charAt(0)) temp = temp.substring(0, temp.length() - 1); return temp; }
306d4e12-9fa9-4713-a450-358245b3ae80
6
@Override public Node beforeDecode(mxCodec dec, Node node, Object into) { if (into instanceof mxChildChange) { mxChildChange change = (mxChildChange) into; if (node.getFirstChild() != null && node.getFirstChild().getNodeType() == Node.ELEMENT_NODE) { // Makes sure the original node isn't modifi...
05723630-efe5-4370-b7f1-d3596408bec3
8
@Override public Result run() { Result result = null; try { Equals<Double> criterion = this.getCriterion(); Function<Double, Double> value = this.getFunction(); double goalValue = this.getGoalValue(); int maxIter = this.getMaximumIterations(); ...
10daf08a-2e02-4d35-b5fb-6b3af6ca9a4f
4
public byte[] toByteArray(){ ByteArrayOutputStream bos = new ByteArrayOutputStream(); ObjectOutput out = null; try { out = new ObjectOutputStream(bos); out.writeObject(this); return bos.toByteArray(); }catch(Exception e){e.printStackTrace(); return null;} finally { try {if (out != null) {out.c...
f2aefbe6-3809-45bf-bae8-07e0fdf0fc9f
8
@Override public void process(OurSim ourSim) { Peer peer = ourSim.getGrid().getObject(peerId); if (!peer.isUp()) { return; } PeerRequest request = peer.getRequest(requestSpec.getId()); if (request == null && !repetition) { request = new PeerRequest(requestSpec, requestSpec.getBrokerId())...
e71d21c5-774e-4c39-97cd-4ce91ffd491b
3
private Tag findInSuggestedTags(String value) { if (suggestedTags != null) { for (Tag tag : suggestedTags) { if (tag.getTag().equalsIgnoreCase(value)) { return tag; } } } return null; }
14dbba79-590c-46b5-bb77-2752a1f0bf04
8
public String createPortOutput(int port, boolean resolve) { String output = ""; if (port == 0) return "0"; if (tcpServices != null) { if ((port < 1024) && resolve) { // try to resolve port number into clear text if ((tcpServices != null) && (output=tcpServices[(int)port-1]) != null) { ...
47e0b291-6ff7-44d8-b139-19ef1cfff8fe
8
public HitResult hit(int StartX, int StartY, int EndX, int EndY, Vector<GameElement> Elements) { HitResult Result = new HitResult(); Result.setHit(false); Result.setHitElement(null); while(StartX != EndX || StartY != EndY) { if(StartX > EndX) ...
04096987-f30e-4b3d-88d1-f81e91a46b8f
5
private void method45() { aBoolean1031 = true; for (int j = 0; j < 7; j++) { anIntArray1065[j] = -1; for (int k = 0; k < IdentityKit.length; k++) { if (IdentityKit.designCache[k].aBoolean662 || IdentityKit.designCache[k].anInt657 != j + (aBoolean1047 ? 0 : 7)) { ...
083d493b-6ed8-4fed-9d9d-836b560bf4dd
5
public String getFullName() { String title = this.title == null ? "" : this.title.trim(); String firstName = this.firstName == null ? "" : this.firstName.trim(); String middleName = this.middleName == null ? "" : this.middleName.trim(); String lastName = this.lastName == null ? "" : this...
aaa9b824-fe50-4395-b346-e943bae63830
1
public void restoreHealth(String userName){ try { cs = con.prepareCall("{call SET_HEALTH_TO_MAX(?)}"); cs.setString(1, userName); cs.executeUpdate(); } catch (SQLException e) { e.printStackTrace(); } }
f2449d8e-87ad-4712-a56f-ffbeb22398fa
1
public static void print(int array[]){ System.out.println("****************Sort Array***************"); for(int i = 0; i < array.length;i++){ System.out.print(array[i] +" "); } System.out.println(); }
11d039f3-e60a-4c05-9943-d1a1f6eb5e87
7
private int calculateNotAppropriateWorkingDaysForTeacherIIIAndIV() { int penaltyPoints = 0; List<LinkedHashMap> teachersAllDay = getAllDaysTeacherTimeTable(); for (LinkedHashMap<String, LinkedHashMap> daysTimeTable : teachersAllDay) { // Very dirty hack because of rush ...
151a7d94-8664-4855-ac12-3af712a1acc9
2
public void salvarSQL(String destino) { String str[]; str = this.getSQL(this.src); Formatter saida = null; try { saida = new Formatter(destino); saida.flush(); for (int i = 0; i < str.length; i++) { saida.format("%s ;\n\n", str[i]); ...
c7d97d10-1806-4046-a64a-6c1823c1badf
0
public String getItemcode() { return this.itemcode; }
1d9b8598-168e-43c8-b25b-46995c3e89c3
8
private StringBuilder getSectionFoto() throws ClassNotFoundException, SQLException { StringBuilder sb = new StringBuilder(); sb.append("<div class=\"bs-docs-section\">"); Utils.appendNewLine(sb); sb.append("<h1 id=\"foto\" class=\"page-header\">Fotogaléria</h1>"); Utils.appendN...
e8eb5363-cb2d-4080-80ed-1e23edccb68e
4
protected Class loadClass(String name, boolean resolve) throws ClassFormatError, ClassNotFoundException { name = name.intern(); synchronized (name) { Class c = findLoadedClass(name); if (c == null) c = loadClassByDelegation(name); if (c == nul...
7ca79c3e-9225-4df2-9473-32709d4d3928
1
public JScrollPane getScrollPane_1() { if (scrollPane_1 == null) { scrollPane_1 = new JScrollPane(); scrollPane_1.setViewportView(getTaChat()); } return scrollPane_1; }
a1bc886e-f1d7-4c6d-9b3f-6c4eb1ba9a2d
8
private ArrayList<Point> aStarSearch(Point location, Point destination, Campus campus) { int traveled = 0; PriorityQueue<CPoint> frontier = new PriorityQueue<CPoint>(); ArrayList<Point> solution = new ArrayList<Point>(); ArrayList<Point> observations; HashMap<Integer,Point> explored = new Has...
720ccad0-1e7f-43d1-909f-e97fcad2c242
1
public Geometry getGeometry() { if (geometry != null) { return geometry; } render(); GeometryFactory gf = Helper.getGeometryFactory(); Coordinate[] labelCorners = new Coordinate[5]; SVGRect textBox = text.getBBox(); labelCorners[0] = new Coordinate(textBox.getX(), textBox.getY()); labelCorners[1] = n...
c3734222-c785-4ecf-9d32-0cc37702399d
8
private Object[] getDefaultValues (Class type) { if (!usePrototypes) return null; if (classToDefaultValues.containsKey(type)) return classToDefaultValues.get(type); Object object; try { object = newInstance(type); } catch (Exception ex) { classToDefaultValues.put(type, null); return null; } Obje...
1f234a2e-225e-4b95-936e-19485f80ede3
7
public void musStart(){ while(true) { hand = (hand + 1) % 4; boolean discardFase = true; deck = new MusDeck(); deck.shuffle(); for(int i = 0; i < player.length; i++) { player[i].clearHand(); player[i].receive(deck.deal(4)); } while(discardFase){ turn = hand; player[t...
2d6eb867-240f-4d88-84a6-173f88fd21b3
6
private void parseChildren(Element e, XMLTag tag) { NodeList children = e.getChildNodes(); for (int i = 0; i < children.getLength(); i++) { Node nChild = children.item(i); if (nChild.getNodeType() == Node.ELEMENT_NODE) { Element eChild = (Element) nChild; ...
a0d6b655-9fa0-486d-b445-6cc8510219c2
2
public void saveLevel(Board board) throws LevelMisconfigurationException { // the parent folder where the file is created inside File parentFolder = new File( CoreConstants.getProperty("editor.basepath")); /** * start to validate level configuration */ // list with positions of all diamonds List<P...
219a1c85-e38c-4fa8-90c6-563714f8ee60
8
public boolean addScore(String playerName, int scored) throws CouldNotSaveFileException { Score score = new Score(scored, playerName); if (scores.size() < MAX_SCORES || score.compareTo(scores.getLast()) < 0) { ListIterator<Score> it = scores.listIterator(); while (it.hasNext() && it.next().compareTo(score)...
f73a20ab-d8c3-46fc-a8d1-7293bf12d487
6
private static void add(Map<Class<?>, Class<?>> forward, Map<Class<?>, Class<?>> backward, Class<?> key, Class<?> value) { forward.put(key, value); backward.put(value, key); }
e041e06c-eb12-4a18-988a-1f6af9cbd79e
7
public static Vector<String> parseSquiggleDelimited(String s, boolean ignoreNulls) { final Vector<String> V = new Vector<String>(); if ((s == null) || (s.length() == 0)) return V; int x = s.indexOf('~'); while (x >= 0) { final String s2 = s.substring(0, x).trim(); s = s.substring(x + 1).trim(); i...
6b756c77-596a-44dd-8691-dcf9548095a9
1
public static void main(String[] args) throws Exception { // TODO Auto-generated method stub File file = new File("C:/1.txt"); in = new BufferedReader(new FileReader(file)); String line; while ((line = in.readLine()) != null) { int n = Integer.parseInt(line); System.out.println(fibonacci(n)); } ...
91479b59-6d8b-478c-b24d-12e0b9250c9c
4
private boolean optionsHasAnyOf( OptionSet options, Collection<OptionSpec<?>> specs ) { for ( OptionSpec<?> each : specs ) { if ( options.has( each ) ) return true; } return false; }
43c3cb75-e93f-4735-a914-cf4fa15c8428
1
public List<Object> getContent() { if (content == null) { content = new ArrayList<Object>(); } return this.content; }
beba2a1e-4651-41ae-9a60-4dea0e50efef
5
@Test public void testValue() { System.out.println("value"); Equals<Double> instance = this._instance; for (int i = 0; i < this._values.length; i++) for (int j = 0; j < this._values.length; j++) { boolean expResult = false; for (Equals<Double> e : ...
1085345e-985a-4bfe-891e-2e770bcd512b
4
public MBeanServerConnection connect() throws MBeanServerConnectionException { if (vmd == null) { throw new MBeanServerConnectionException(ReturnCode.ServerNotFound); } try { VirtualMachine vm = VirtualMachine.attach(vmd); String connectorAddress = getConnectorAddress(vm); if (connectorAddress == nu...
737c69cc-ff5c-4fe9-b743-d020c298dac3
2
public void createStatesForConversion(Grammar grammar, Automaton automaton) { initialize(); StatePlacer sp = new StatePlacer(); String[] variables = grammar.getVariables(); for (int k = 0; k < variables.length; k++) { String variable = variables[k]; Point point = sp.getPointForState(automaton); State s...
57002b1f-73eb-47d4-aea1-d2c92672b55d
9
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; final Interval other = (Interval) obj; if (end == null) { if (other.end != null) return false; } else if (!end.equals(other.end)) ret...
d2d2fe32-6dcd-4a34-ad1e-7fb4ebc63c7d
5
@Override public String toString() { String output = ""; if (isStart) output += "(START)\t"; else if (isFinal) output += "(FINAL)\t"; else output += "\t"; for (String key : transitions.keySet()) { output += key + "\t"; } output += "\n" + name + "\t"; for (String key : transitions.keySet()) ...
ced884d7-ebbf-49a7-ae9f-df9741444f09
7
public static void main(String[] argv) { JFrame mainWindow = new JFrame("Übung3"); mainWindow.setLayout(new GridLayout(rows, columns)); mainWindow.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); mainWindow.setBackground(Color.white); mainWindow.setSize(800, 800); mainWindow.setLocationRelativeTo(null); ...
42e11d32-5597-488b-ae9a-fd2e2c316562
7
private Instances[] computeInfoGain(Instances instances, double defInfo, Antd antd){ Instances data = new Instances(instances); /* Split the data into bags. The information gain of each bag is also calculated in this procedure */ Instances[] splitData = antd.splitData(data, defInfo); Instance...
633eef44-ade4-45c4-8f5f-c19970d30213
8
public double calculate(HttpServletRequest request) { int shape = Integer.parseInt(request.getParameter("s")); // double result; switch (shape) { case 0: calc = new RectangleCalculator(); return calc.calcArea(parseValue(request.getParameter("l...
89de9f24-3b72-4600-8084-87e37f29df96
4
public static int[] factorsOf(int number) { if (number < 0) { throw new IllegalArgumentException("Error: int cannot be < 0!"); } int half = Math.round(number / 2); ArrayList<Integer> factorsList = new ArrayList<Integer>(); for (int j = 1; j <= half; j++) { if (number % j == 0) { factorsList.add(j);...
9c2b35af-81e0-4ef3-9e15-5219562031d3
2
public static void main(String args[]) { TowerDefenseGame game = new TowerDefenseGame(); game.initConnection(); while (!game.checkInitalBridge()) { try { sleep(delay); } catch (InterruptedException e) { e.printStackTrace(); } System.out.println("Try Create"); } }
0cbaa4bd-fd90-4454-877e-e2fa066f65fc
8
@Override public List<TrainingDataDTO> getTraningDataByCrisisAndAttribute(int crisisID, int modelFamilyID, int fromRecord, ...
a1a4573f-e104-439f-a9bb-806324af5417
5
public static void runCPP(final String s2) { Thread t = new Thread(){ public void run() { String s = new String("\n#include <iostream>\n" + "using namespace std;\n" + "int main() {\n" + s2 + "\n" + "return 0; \n}"); ArrayList<String> data = new ArrayList<String>(); ...
022a7bd7-04bc-4772-a565-c189a9740749
4
public float[][] GenerateFurniHeightMap() { float[][] FurniHeightMap = new float[this.GrabModel().MapSizeX][this.GrabModel().MapSizeY]; for(int x = 0; x < this.GrabModel().MapSizeX; x++) //Loopception courtesy of Cobe & Cecer { for(int y = 0; y < this.GrabModel().MapSizeY; y++) { if(FurniCollisionM...
07e474cd-892b-414e-85c4-8cf70de0ac46
2
private AnimationType generateAnimation(String animation) { if (animation.contains("MoveCardAnimation")) { if (animation.contains(":")) { // has parameters pass them to the constructor return new MoveCardAnimation(animation.split(":")[1]); } else { return new MoveCardAnimation(); } } ...
7d9f2f4e-2168-4064-84d3-1f0d8e4e2bae
0
public BasicFileFilter() {}
05ccac7c-8470-413e-a1ef-9acf4ca1de01
6
@Override public void process() { session.log("Loading class for client: \""+clientClassName+"\""); Class clnMain; try { clnMain = Class.forName(clientClassName); }catch(ClassNotFoundException clnfe){ session.log("Unable to load class\n"+clnfe.toString()); return; ...
fb0e7253-bfcd-4eb9-b1e5-a669400daa94
3
public static double toRadians(double x) { if (Double.isInfinite(x) || x == 0.0) { // Matches +/- 0.0; return correct sign return x; } // These are PI/180 split into high and low order bits final double facta = 0.01745329052209854; final double factb = 1.99784475...
a78f70d5-059b-438b-88d8-5e5e4b05e471
3
private static boolean tryToOccupyUrinalAndSurvive() { int urinalToOccupy = askForNumberBetween( "Which Urinal shall be occupied?", minUrinals, bathroom.urinalCount() ); UrinalStatus status = bathroom.occupyUrinalVO( urinalToOccupy-1 ); switch( status ) { case FREE_SAVE: print( "Aaaaah. That's better..." )...
13166554-ddf3-47ab-9347-4ec0b53e7d26
6
public void toggleAction(Action a, boolean is) { if (a == null) return ; if (! a.actor.inWorld()) { I.complain(a+" TOGGLED BY DEFUNCT ACTOR: "+a.actor) ; } final Target t = a.target() ; List <Action> forT = actions.get(t) ; if (is) { if (forT == null) actions.put(t, forT = new L...
d718b857-45b3-4ffa-90a3-647d41316a68
1
public boolean checkAccess(Administrador admin){ try { PreparedStatement ps = this.mycon.prepareStatement("SELECT * FROM Administradores WHERE userName=? AND passwd=?"); ps.setString(1, admin.getNombre()); ps.setString(2, admin.getPassword()); ...
e0b029ae-ae41-41a0-9158-fa5144664d93
5
public int getRealWidth() { int c = 0; for (int x = 1; x < width; x++) { for (int y = 0; y < height; y++) { int col = pixels[x + y * width]; if (col == -1 || col == 0xffff00ff) c++; } if (c == height) return x; c = 0; } return width; }
4809c987-1675-48ee-be1a-9189675457d8
0
public void setSysMessage(String sysMessage) { this.sysMessage = sysMessage; }
fe81b501-bfc5-4448-ab69-202944019868
2
public boolean overTwoTimes(int[] counts) { for (int i = 0; i < counts.length; i++) { if (counts[i] > 1) return false; } return true; }
342ac369-892d-432a-a58f-ad72382c87ea
2
private static double getHighThreshold(ImageProcessor gradient, double percentNotEdges){ gradient.setHistogramSize(64); int[] histogram = gradient.getHistogram(); long cumulative = 0; long totalNotEdges = Math.round(gradient.getHeight()*gradient.getWidth()*percentNotEdges); int buckets = 0; for(; buckets < ...
1b1ddfa7-ad40-4904-9741-1e16c46a1cb2
3
public boolean load(String audiofile) { try { setFilename(audiofile); sample = AudioSystem.getAudioInputStream(getURL(filename)); clip.open(sample); return true; } catch (IOException e) { return false; } catch (UnsupportedAudioFileException e) { return false; } catch (LineUnavailableException...
8e0e8116-d0fe-43ee-b4aa-f8bacc46860d
0
private void dehighlight() { pane.tablePanel.dehighlight(); pane.grammarTable.dehighlight(); }
3fd9f93f-5d69-4c47-8257-2f99573376e9
6
@Override public synchronized void advance(double smpSecondsElapsed,double seqSecondsElapsed){ int chan=output.length; for(int i=0;i<chan;i++) output[i]=0; boolean stop=terminate; Node n=head.next; while(n.next!=null){ double[] signal=n.sound.getSignal(smpSecondsElapsed,seqSecondsElapsed); if(signal==n...
009cb813-3e45-45b0-9aa9-03f4086b7c13
3
void updateInOut(FlowBlock successor, SuccessorInfo succInfo) { /* * First get the gen/kill sets of all jumps to successor and calculate * the intersection. */ SlotSet kills = succInfo.kill; VariableSet gens = succInfo.gen; /* * Merge the locals used in successing block with those written by this ...
d89fa25c-8466-44f3-8976-6cec57cb9270
8
@Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; RelationshipFamilyEntity that = (RelationshipFamilyEntity) o; if (relationshipId != that.relationshipId) return false; if (familyId1 != null ? ...
806ac051-437d-46d8-b485-15c475d961cb
9
private static void printLCS(int[][] lcs, char[] x, char[] y, int i, int j) { if(i >0 && j >0 && x[i-1]==y[j-1] ){ printLCS(lcs,x,y,i-1,j-1); //Prints only if X == Y... System.out.print(x[i-1]); }else if(j>0 && (i==0 || lcs[i...
f3bd5943-821c-4da7-8db9-327d9d51b6d6
4
private static void createDirectory(FileSystem fileSystem, String path) throws TestFailedException { try { fileSystem.createDirectory(path); if (!fileSystem.pathExists(path)) throw new TestFailedException("I created the directory " + path + ", but pathExists says it does not exist"); } catch (PathNotFoun...
2b0839e6-e8d7-49d7-abc9-57c2fb77998f
5
public void addNode(int value, int leftValue, int rightValue) { if (leftValue == -1 && rightValue == -1) { return; } Node node = this.getNodeByValue(value); if (node == null) { System.out.println("Error, no node with value:" + value); ...