method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
5726d48e-7a1a-4d18-8f7e-4ce9b9fcf243
7
@Override protected void validateParameters(Map<String, String> parameters) { //mandatory parameters for multi use pipeline if (!parameters.containsKey("globalAmountLimit")) { throw new RuntimeException("globalAmountLimit is missing in parameters."); } //conditio...
035864f7-c6d9-4288-a99f-931aed53f219
8
public static void main(String[] args) throws Exception{ String fileName=args[0]; int jarPost=fileName.indexOf(".jar"); String jarName=fileName.substring(0,jarPost); // String jarName="ciku"; f = new ZipFile(fileName); Enumeration<? extends ZipEntry> en=f.entries(); Scanner checkAll...
ea3c5083-755a-473f-a284-ec2596fe8c1c
8
private void parseEllipsoid(Map<String, String> params, DatumParameters datumParam) { double b = 0; String s; /* * // not supported by PROJ4 s = (String) params.get(Proj4Param.R); if (s != * null) a = Double.parseDouble(s); ...
368ee42c-1ea7-4f3d-bf92-4d169b10c62b
2
public void alert(String msg){ for (Player p : Bukkit.getOnlinePlayers()) { if (p.hasPermission("hyperpvp.seereports")) { p.sendMessage(msg); } } }
8d38eb30-ba69-4966-a10a-1f36de66e8d3
7
public static void main(String[] argument) { try { if (argument.length == 4) { InputStream inputStream = new FileInputStream(argument[0]); OutputStream outputStream = new DeflaterOutputStream(new FileOutputStream(argument[1]), new...
6b8d991e-9c38-4661-8069-df605e737c63
9
private int edmondKarp() { int f = 0; // Det maximala flödet int m, bFlow; Edge v, u, ub; while (true) { // Infinate loop m = BFS(); if (DEBUG_EK) { System.err.println("m: " + m + " path: " + edgeArrayToString(path)); } // When the BFS doesn't find anymore augmenting paths if (m == 0)...
cf4f243f-b4e6-4bb8-bbab-01a97c1c17c9
7
public static Set<Node> findMostVisitedNodes(Set<TreeRandForest> ngfForest, int noNodes){ HashMap<Node, Integer> countNode = new HashMap<Node, Integer>(); // map Node to # visits for (TreeRandForest t : ngfForest){ for (Node n : t.features()){ if (countNode.containsKey(n)){ ...
d3b4530c-f7b5-458c-9b52-948084d43e08
6
@Override public double[] get2DData(int px, int pz, int sx, int sz) { double[] res = new double[sx*sz]; int ind = 0; for (int x = 0; x < sx; x++) for (int z = 0; z < sz; z++) { double xin = (x + px) / xScale; double yin = (z + pz) / zScale; double n0, n1, n2; // Noise contributions...
f76242b2-93b7-41a0-b27f-791bb4779642
3
public void notifyStopped(SoundRecord paramSoundRecord, boolean paramBoolean) { if (paramSoundRecord.getSoundListener() != null) { paramSoundRecord.getSoundListener().soundStopped(paramSoundRecord.getName(), paramBoolean ? 0 : this.muted ? 2 : 1); } this.soundRecords.r...
d83e6fdf-0a09-4fcb-9f21-c8e8fe0568c2
4
public String printCreatures(){ String result = ""; for (int i = 0; i < this.creatures.size(); i++) { Creature tempItem = this.creatures.get(i); if (i == (this.creatures.size() - 1)) { if (tempItem.toString().substring(0, 3).equals("The")) { re...
811c763d-0506-4c0b-834d-efc94555b7a6
2
public static RgbImage convertToRgb(HsvImage hsv) { RgbImage rgb = new RgbImage(hsv.getWidth(), hsv.getHeight()); for (int x = 0; x < rgb.getWidth(); x++) { for (int y = 0; y < rgb.getHeight(); y++) { RgbPixel px = convertPixel(hsv, x, y); rgb.setPixel(x, y, RED, px.red); rgb.setPixel(x, y, GREEN, px...
87e4e6f1-adb9-48de-81f2-e9b2a8e9d2bf
0
@XmlElementDecl(namespace = "http://www.w3.org/2001/04/xmlenc#", name = "EncryptedKey") public JAXBElement<EncryptedKeyType> createEncryptedKey(EncryptedKeyType value) { return new JAXBElement<EncryptedKeyType>(_EncryptedKey_QNAME, EncryptedKeyType.class, null, value); }
be483227-2a8f-46c3-9e8c-407939c7d928
9
public void exportCSV() { try { PrintWriter pw = new PrintWriter("export.csv"); pw.println("\"Step\",\"Server\",\"Application\",\"Links\""); int step = 0; for (int i = 0; i < bpgHistory.getApplicationHistory().get(step).size(); i++) { for (int j = ...
cdddc51a-7583-4f5d-9461-bb3b854414ce
1
private static boolean getKeyUp(int keyCode) { return !getKey(keyCode) && lastKeys[keyCode]; }
62f7ea7a-3b88-472b-985a-7bf20974b20a
8
public ITestRefImpl(ITestParamState initRefParam) { ITestParamState useClassParam = initRefParam.getElement(USE_CLASS); if ( null != useClassParam && null != useClassParam.getValue() ) { try { this.useClass = Class.forName(useClassParam.getValue()); ...
4d5a798a-bdd8-4527-a615-eb107d80d4d0
2
public final void setLName(String lname) { if(lname == null || lname.isEmpty()){ throw new IllegalArgumentException(); } this.lName = lname; }
66cd289b-0a1d-4b8b-98ba-2780ffe571d0
4
private boolean checkIfDFAisComplete() { Transition[] t=automaton.getTransitions(); State[] s=automaton.getStates(); TreeSet <String> reads=new TreeSet<String>(); for (int i=0; i<t.length; i++) { reads.add(t[i].getDescription()); } int count=0; for (int i=0; i<s.length; i++) { Transition[] tt=a...
17290167-33cc-4d17-a4e4-e5f57186c6be
3
private List<String> retriveData(String projectionLink) throws IOException { List<String> playerData = new ArrayList<String>(); InputStream input = new URL(projectionLink).openStream(); try (BufferedReader br = new BufferedReader(new InputStreamReader(input, "UTF-8"))) { // skips...
24204aa2-63fb-4061-a3d4-dfdefa823aae
9
@Override public int compareTo(Contestant otherC) { // ugly, but works. :) // account for null: if (isNull() && otherC.isNull()) { return 0; } else if (isNull() && !otherC.isNull()) { return -1; } else if (!isNull() && otherC.isNull()) { return 1; } // otherwise both are not null: int resul...
8c7846ba-92b1-4e9b-adb7-cac375117af2
6
public void play(InputStream source) { // use a short, 100ms (1/10th sec) buffer for real-time // change to the sound stream int bufferSize = format.getFrameSize() * Math.round(format.getSampleRate() / 10); byte[] buffer = new byte[bufferSize]; // create a line to play to SourceDataLin...
c3a925c8-82af-464e-a1b6-4af32059dbd2
1
private void fire(Type t, EventObject E) { Object[] listeners = ll.getListenerList(); for (int i = listeners.length - 2; i >= 0; i -= 2) { ((Listener) listeners[i + 1]).notice(t, E); } }
2a45c0cf-5620-42b5-9ede-6914d9e182d0
6
private boolean setAustinMap(String mapName){ Image mapImage = null; ImageIcon imageIcon; boolean hasFile = false; austinSearchPanel.appendText(">> Connecting... \n" + ">> Destination: " + urlStr + " \n"); if (url_status){//If URL connection is available, downloads the image. try { UR...
5abb946f-60f2-47e0-b1f4-96106b9812c0
5
public void setItem(int index, int id, short dam, String title, String action, List<String> lore) throws IllegalArgumentException { String[] acpar = action.split("\\|"); if(acpar.length != 2) return; if(index < 0 || index > 26) throw new IllegalArgumentException("Index is "+(index < 0 ? "too...
57faa3e8-4b86-4577-a433-46da006e392c
5
public int[][] getPixels2i() { int r; int[][] pix = new int[ih][iw]; double[] tem = new double[ih * iw]; double max = 0, temp, re, im; System.out.println("还原图开始"); for (int j = 0; j < h; j++) { for (int i = 0; i < w; i++) { re = fd[j * w + i].re(); im = fd[j * w + i].im(); temp = (i...
78ed66c3-85e3-4a3a-93f2-3a7253fa2208
8
@Override public void setupJob(JobContext jobContext) throws IOException { /** * note: we don't really have to do anything here - * MongoDB is one of the few systems that don't require you to * create a database or collection before writing to it * * but in order to ingest a ton of data quickly we...
1ada782c-3685-4831-86a3-2c9e7e8a599d
6
public void pickCode() { codeNum1 = (int) (Math.random()*10); do { codeNum2 = (int) (Math.random()*10); } while (codeNum2==codeNum1); do { codeNum3 = (int) (Math.random()*10); } while ((codeNum3==codeNum1)||(codeNum3==codeNum2)); do { codeNum4 = (int) (Math.random()*10); } while ((codeNum4==codeN...
ce7c2c12-ff1d-4cf6-8f1c-26830a3a9712
9
private Move searchStrategy() { Move move = null; double maxCoinsPerMove = 0; for (int x = 0; x < size; x++) { for (int y = 0; y < size; y++) { Point p = board.getPoint(x, y); // Only focus on capturing neutral or opponent coins if (p.owner != id) { ArrayList<Move> moves = movesToDoubl...
d16802dc-0fde-4b8a-8c22-d017c6bf27b3
5
public String beschrijving() { StringBuilder s = new StringBuilder(); s.append(standaardGegevens()); if (ouders != null) { if(ouders.getOuder1() != null) s.append("; 1e ouder: ").append(ouders.getOuder1().getNaam()); if(ouders.getOuder2() != null) ...
512331f3-56bc-4e0a-8aa8-432a03282d8b
0
public double getValue() { return value; }
a06d02b0-c3ba-4c1b-82ae-59b09b681411
8
public void putAll( Map<? extends Character, ? extends Double> map ) { Iterator<? extends Entry<? extends Character,? extends Double>> it = map.entrySet().iterator(); for ( int i = map.size(); i-- > 0; ) { Entry<? extends Character,? extends Double> e = it.next(); thi...
4a5fe30e-2a1b-4d92-8be2-21200b4da042
7
String checkPrivCommand (String msg) { Scanner s = new Scanner(msg); String command = s.next(); int tableID = 0; if (s.hasNext(tablePattern)) { tableID = s.nextInt(); } String d = s.next(datePattern); String t = s.next(timePattern); String key = s.next(keyPattern[tableID]); ...
f97c8add-9c38-451f-bd9e-756c92d3e3f2
1
public int getLUSLength(){ //Run the LUS computations, if they haven't been done yet if (lus_cache.isEmpty()) getLUS(false); return lus_max_length; }
9a89eed6-527e-4436-81ba-2013e4c903e6
4
private void addBlockToRed() { debug("Adding block to red"); if (rLoc1.getBlock().getType() == Material.AIR) { rLoc1.getBlock().setType(Material.GOLD_BLOCK); } else if (rLoc2.getBlock().getType() == Material.AIR) { rLoc2.getBlock().setType(Material.GOLD_BLOCK); } ...
2a60072f-129c-4dbc-840e-bca3fa3ddf23
8
public void method558(int i, int j) { if(i < 0 || i > versions.length || j < 0 || j > versions[i].length) return; if(versions[i][j] == 0) return; synchronized(nodeSubList) { for(OnDemandData onDemandData = (OnDemandData) nodeSubList.reverseGetFirst(); onDemandData != null; onDemandData = (OnDemandData...
42923baf-ff1c-4253-8c1b-f147f2492ed7
2
public static void deleteVelo(Velo velo) { Statement stat; try { stat = ConnexionDB.getConnection().createStatement(); stat.executeUpdate("delete from velo where id_velo="+ velo.getId_velo()); } catch (SQLException e) { while (e != null) { Sys...
5ea269d9-ea37-4f1d-b51c-6ddffdc2c1f3
7
public void gatherInformation() { StringBuilder builder = new StringBuilder(); //Append current date String date = new SimpleDateFormat("YYYY-MM-dd").format(new Date()); builder.append("Date="); builder.append(date); builder.append("\n"); if(Main.VERBOSE...
de6bd4cc-7eff-4a28-a4cf-e021dfe7f957
2
@Override public void contextInitialized(ServletContextEvent sce) { logger.info("Initialize JdbcRealm database"); Connection cnn = null; try { if (dataSource == null) { throw new IllegalStateException("DataSource not injected, verify in web.xml that 'metadata-comp...
62d752ee-3cec-4499-a867-e6f0269787b5
5
@Override public void tick(int i, int j, int k) { Vector2 buttonPos = new Vector2((float) (pos.x+(dim.x-buttonWidth)*progress),pos.y); if(buttonPos.getColliderWithDim(new Vector2(buttonWidth,dim.y)).isPointInside(new Vector2(i,j)) && Remote2D.hasMouseBeenPressed()) { mouseDown = true; offset = i-buttonPos....
614adf23-737f-4a81-a9fc-a651e05a1ef7
4
private int[] getResList() { Object[] resList = super.getLocalResourceList(); int resourceID[] = null; // if we have any resource if ((resList != null) && (resList.length != 0)) { resourceID = new int[resList.length]; for (int x = 0; x < resList.length; x++) ...
7749931d-1f11-4b69-bae4-d6500106367a
5
@Override public void paint(Graphics g) { // Because of init ordering, this is required to not through null exceptions during init. if (bufferGraphics == null) return; // Get font sizes else if (mainFontMetrics == null) { mainFontMetrics = bufferGraph...
b2d52c01-aeff-4dca-b682-aa8bf60ff757
8
public void mousePressed(MouseEvent e) { switch (subMode) { case Constants.EDIT_LUGAR: addPlace(e); break; case Constants.EDIT_TRANS: addTransition(e); break; case Constants.EDIT_LABEL: addMarker(e); break; case Constants.EDIT_ARC: setStartArc(e); break; case Constants.EDIT_MOUSE: ...
b06505f2-db33-4edf-b552-e447445bd6aa
9
int insertKeyRehash(double val, int index, int hash, byte state) { // compute the double hash final int length = _set.length; int probe = 1 + (hash % (length - 2)); final int loopIndex = index; int firstRemoved = -1; /** * Look...
21e05ec3-00fb-413d-b2ac-04b9af1785e5
3
private void doAesthetics() { setSize(new Dimension(220, 155)); setResizable(false); setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE); setLocationRelativeTo(null); mainPanel.setLayout(new BorderLayout()); mainPanel.setBorder(BorderFactory.createEmptyBorder(10, 10,...
d3c16b9b-5ff0-4075-8703-1c7ddbe20957
8
@Override public boolean equals(Object other) { if (other instanceof Tuple) { Tuple otherTuple = (Tuple) other; return (( this.first == otherTuple.first || ( this.first != null && otherTuple.first != null && this.first.equals(otherTuple.first))) && ( this.second == otherTuple.second || ...
474fb7f5-6c3a-44ea-bbb3-219b3f0d53cb
7
private void merge(int left, int middle1, int middle2, int right) { int leftIndex= left; int rightIndex = middle2; int combIndex= left; int[] combArray= new int[array.length]; // output two subarrays before merging System.out.println( "merge: " + subarray( left, middle1 ) ); System.out.println( " ...
83a1c698-fead-42b8-9a1a-c0b8b0ec054f
0
public Instances instancesLoader() throws IOException { Instances data = null; data = new Instances(this.fr); this.closeFR(); // Close the file return deleteUselessAtributes(data); }
7e55101c-b12a-4ffa-aff2-59b6d389b112
1
public static boolean checkForPalindrome(String s){ StringBuilder sb = new StringBuilder(s.length()); for(int i = s.length() -1 ; i >=0; i--){ sb.append(s.charAt(i)); } /* * Alternative method : * new StringBuilder(s).reverse().toString(); */ return s.equals(sb.toString()); }
13e95211-aaf3-484e-a5a7-fb760c654461
2
private int moverListSolido(List listMovibles){ int vivos = 0; Iterator<Solido> itNave = listMovibles.iterator(); while(itNave.hasNext()){ Solido solido = itNave.next(); //lo movemos y retornamos su salud actual if(solido.move...
766f8749-d11b-4c9f-a79b-bdfae80d3f68
7
public static List<Integer> retrieveDoctorFreeSlots(Date date, int doctorID) { DBMinder minder = DBMinder.instance(); ArrayList<Integer> toReturn = new ArrayList<Integer>(); Connection conn = minder.getConnection(); PreparedStatement ps; ResultSet rs; try { //retrieve hours working ...
22aebd80-b612-4bd9-af82-e307b5d7364a
7
public static Keyword continueParallelStrategiesProofs(ParallelControlFrame pframe, Keyword lastmove) { if (lastmove == Logic.KWD_DOWN) { if (pframe.down != null) { ParallelControlFrame.enterParallelThread(pframe, null); return (Logic.KWD_MOVE_DOWN); } return (ControlFrame.continue...
c85c95a5-f057-4449-9b50-e9d5ba5d422d
0
@Test public void testFindStrings_empty() throws Exception { Assert.assertEquals( Arrays.asList(), _xpath.findStrings("//li/text()") ); }
0de3a952-3e05-4bdb-9333-212e75ea925c
7
private AbstractButton getAbstractButton(ButtonModel bm) { if (getContentType().equals("text/plain")) return null; Component[] c = getComponents(); if (c == null || c.length == 0) return null; Container container = null; JComponent comp = null; for (Component x : c) { if (x instanceof Container) { ...
013dbcef-02c5-45ac-9f73-f409c3a1e4b5
9
private static void afficherCoursEtudiant() { ArrayList<Etudiant> listeEtudiant = ListeEtudiants.getInstance().getListe(); // Liste des etudiants int i = 0; // Compteur int element; // Nombre lu au clavier representant le numero d'un etudiant Etudiant choix = null; // Etudiant ...
4a629969-a57b-4cb9-9bb6-da40e5ee4d20
1
private boolean jj_3_28() { if (jj_3R_45()) return true; return false; }
80fc2279-a068-4b1a-9ac5-4eeaddb5d6d8
0
public void SetToLastBusStopTicks(int toLastBusStopTicks) { //set the tick time bus got to the last bus stop this.toLastBusStopTicks = toLastBusStopTicks; }
16559db4-7997-4f80-a7fb-c47d8ff2374e
7
public String columnsToGraphviz(Network network) { beginHeader(); { // command: dot -Tpng -Kfdp network.dot -o network.png int pos = 0; for (ColumnNode column : network.columnNodes()) { addHead(column.base, column.size, pos); for (Node node = column.base.top; node != column.base; node = node.top) {...
46d537d8-adf9-45e5-92f9-e763b513ceee
1
public void testVehiclesRemoved() { TimeServer ts = new TimeServerLinked(); VehicleAcceptor sink = VehicleAcceptorFactory.newSink(ts); Vehicle[] cars = new Vehicle[5]; for (int i = 0; i < cars.length; i++) { cars[i] = VehicleFactory.newCar(ts, sink); sink.accept(cars[i]); } Assert.asser...
fe39a863-424a-4e6a-8fae-2b88e7697030
4
public War readXML() throws ParserConfigurationException, SAXException, IOException { DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); // Get the DOM Builder DocumentBuilder builder; builder = factory.newDocumentBuilder(); InputStream xml_file = ClassLoader .getSystemResourceAsStr...
2c06b272-f45e-40ce-bbec-5342a35ca84c
0
@Test public void testSimple() throws Exception { final Properties p = new Properties(); p.setProperty("type", "Zero"); final Properties[] configs = new Properties[]{p}; final FilterFactory ff = new FilterFactory(configs); final Filter[] filters = ff.getInstances(new MockConn...
06329f08-2ad6-412c-9d75-a65e0f205593
8
public String toString() { String s = ""; if (child1 != null) { s = "(" + child1.toString() + ")"; } s = s + key1; if (child2 != null) { s = s + "(" + child2.toString() + ")"; } else if (keys > 1) { s = s + " "; } if (keys > 1) { s = s + key2; if (child3 !=...
098b87cd-eb44-4156-b44b-e4275b8739b4
8
private SpriteState createTileState(StateMap stateMap, int add, RawMemoryMap memoryMap, int scene, int frame, int scanLine) { byte[] upperTileData = new byte[16]; byte[] lowerTileData = new byte[16]; byte[] paletteData = new byte[8]; boolean flipHorizontally; boolean flipVertically; boolean objT...
5d894e0e-994c-4de3-860e-32fd96901df8
1
public int getInt(Object key) { Number n = get(key); if (n == null) { return (int) 0; } return n.intValue(); }
8d61113c-9389-4c90-b270-f6664029481c
9
protected final String escapeSlow(String s, int index) { int end = s.length(); // Get a destination buffer and setup some loop variables. char[] dest = DEST_TL.get(); int destIndex = 0; int unescapedChunkStart = 0; while (index < end) { int cp = codePointAt(...
9cdd5165-4aaf-4416-872b-5612213583aa
5
public boolean addItem(Item item) { final int oldAmount = (int) amountOf(item) ; if (super.addItem(item)) { final int inc = ((int) amountOf(item)) - oldAmount ; if (venue.inWorld() && inc != 0 && item.type.form != FORM_PROVISION) { String phrase = inc >= 0 ? "+" : "-" ; phrase+=" "+i...
ade3fae6-cdcd-409a-844d-a579cbb3189c
1
@GET @Path("/v2.0/networks/{networkId}") @Produces({MediaType.APPLICATION_JSON, OpenstackNetProxyConstants.TYPE_RDF}) public Response showNetwork(@PathParam("networkId") String networkId, @HeaderParam("Accept") String accept) throws MalformedURLException, IOException{ if (accept.equals(OpenstackNetProxyConstants.T...
0a12c5dc-7b36-49a6-9146-2b02a346efd5
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) { ...
9f3df74a-7576-4a0a-a918-ba57e7621672
7
private void createContents(int coordX, int coordY) { timeDiagramsShell = new Shell(getParent(), SWT.BORDER | SWT.RESIZE | SWT.TITLE); timeDiagramsShell.setSize(563, 498); timeDiagramsShell.setMinimumSize(new Point(300, 300)); timeDiagramsShell.setBounds(coordX, coordY, WIDTH, HEIGHT); ...
572956c6-129a-498f-91df-b17f02f38ca1
0
public void sendProbe() throws IOException { DatagramPacket findBroadcast = new DatagramPacket(probeData, probeData.length, broadcastTarget, Config.DISCOVERPORT); sock.send(findBroadcast); }
02042469-f477-4c0e-ab67-21c6e280a9d3
2
public final void applyProxySettings() { String proxyUrl = Configuration.getProperty("HTTP_PROXY_URL"); if (proxyUrl != null) { System.getProperties().put("http.proxyHost", proxyUrl); } String proxyPort = Configuration.getProperty("HTTP_PROXY_PORT"); if (proxyPort != ...
56a11253-9800-4b88-b891-aca25e005692
5
public int countLines(String filename) throws IOException { InputStream is = new BufferedInputStream(new FileInputStream(filename)); try { byte[] c = new byte[1024]; int count = 0; int readChars = 0; boolean empty = true; while ((readChars = is.read(c)) != -1) { ...
c87f485e-ec72-4ab4-bcad-720b8332e08e
4
private void startField(final Attributes attributes) { String attPosition = attributes.getValue("pos").toUpperCase(); tmpField = new Field(); tmpField.setPosition(FieldPosition.valueOf(attPosition)); tmpField.setType(attributes.getValue("type")); if (attributes.getValue("left...
6590d914-4175-40a0-a59e-6451fb5cdea5
4
public UserDatabase(){ // load login information from file file = new File("data.txt"); try { Scanner scanner = new Scanner(file); while (scanner.hasNextLine()) { String username = scanner.next(); String password = scanner.next(); ...
6ccaf8ba-6275-439f-92be-0fe3fb3e4402
3
private void printObjectDebug(Object ob) { if (ob == null) { log.finer("null object found"); } else if (ob instanceof PObject) { PObject tmp = (PObject) ob; log.finer(tmp.getReference() + " " + tmp.toString()); } else if (ob instanceof Dictionary) { ...
8a96f944-b2a7-4d60-bd52-2b992e2628e6
5
private void addAllUniforms(String shaderText) { HashMap<String, ArrayList<GLSLStruct>> structs = findUniformStructs(shaderText); final String UNIFORM_KEYWORD = "uniform"; int uniformStartLocation = shaderText.indexOf(UNIFORM_KEYWORD); while(uniformStartLocation != -1) { if(!(uniformStartLocation != 0 ...
8ef4a118-d1c5-4f66-8922-48b27a4be1a2
6
public static boolean isStraight(List<Card> cards) { boolean isStraight = true; int startValue = 0; // If the first card is an ACE and the last one a // TWO there might be a "small" straight (ACE, TWO, // THREE, ...), so than start with the second // highest card at index 1 // Avoid null poi...
b6fdf951-f25b-48f9-a167-656eb353b45b
2
public boolean rankMatch( LinkedHashMap<String, LinkedHashMap<String, String>> humanPropRoot, String correctName1, String correctName2) { if (humanPropRoot.containsKey(correctName1) && humanPropRoot.containsKey(correctName2)) return true; else return false; }
2ab86693-2cfe-40ef-b788-ad2985be02b5
0
public int getSize() { return size; }
4a37325a-2877-42ab-b3a4-5563a6a21cb4
9
public CheckResultMessage checkSum4(int i, int j) { int r1 = get(17, 2); int c1 = get(18, 2); int tr1 = get(33, 5); int tc1 = get(34, 5); BigDecimal sum = new BigDecimal(0); if (checkVersion(file).equals("2003")) { for (File f : Main1.files1) { try { in = new FileInputStream(f); hWorkbook =...
9e93a17c-0f40-4c3a-be7b-671889eff111
3
public void echo(Scanner in, PrintWriter out){ boolean done = false; while (!done && in.hasNextLine()) { String line = in.nextLine(); out.println("Echo: " + line); if (line.trim().equals(Constants.SHUTDOWN_MESSAGE)) done = true; } }
bbf9df30-de0e-4327-9ba3-529d002ea2b7
2
public void prettyPrint(){ for(int i = 0; i < x; i++){ for(int j = 0; j < y; j++){ System.out.print(mat[i][j]); System.out.print("\t"); } System.out.println(); } }
fd8f6e83-1d9a-42e3-af14-19d16215d8f7
2
public ConverterAdapter(ConvertiblePair typeInfo, Converter<?, ?> converter) { this.converter = (Converter<Object, Object>) converter; this.typeInfo = typeInfo; }
6fcd1c00-c53f-40d7-9472-76a86ef3535a
7
public void method276(int y, int x) { GroundTile groundTile = groundTiles[0][x][y]; for (int z = 0; z < 3; z++) { GroundTile heightGroundTile = groundTiles[z][x][y] = groundTiles[z + 1][x][y]; if (heightGroundTile != null) { heightGroundTile.anInt1307--; for (int j1 = 0; j1 < heightGroundTile.anInt131...
e7a4edd7-bdcf-426b-8f32-67233648b68d
1
public void testIsBefore_TOD() { TimeOfDay test1 = new TimeOfDay(10, 20, 30, 40); TimeOfDay test1a = new TimeOfDay(10, 20, 30, 40); assertEquals(false, test1.isBefore(test1a)); assertEquals(false, test1a.isBefore(test1)); assertEquals(false, test1.isBefore(test1)); assert...
7894635a-1db8-4cc7-bddd-8815a86a1c41
4
private void onDoneClick() throws IOException { for (ImageMarker marker: cornerAndControlMarkers) { if (marker.getID() == null) { JOptionPane.showMessageDialog(this, "You can't be done until you've " + "labeled every corner and control ...
d7e13b2d-bf2e-4c93-8693-91c6d2350ee2
2
private static void startComboBox() { language.removeAllItems(); language.addItem(model.save.SettingsModel.getLocale().getDisplayLanguage( model.save.SettingsModel.getLocale())); Locale[] l = model.save.SettingsModel.getAllLocales(); for (int a=0; a< l.length; a++){ if (!(l[a]).equals(model.save.Settings...
487382b9-1a73-47db-9013-7a8f691b9fe2
3
public JSONWriter object() throws JSONException { if (this.mode == 'i') { this.mode = 'o'; } if (this.mode == 'o' || this.mode == 'a') { this.append("{"); this.push(new JSONObject()); this.comma = false; return this; } t...
c84d864e-8fd6-4f05-8b0b-b9e35fec62fd
4
public Tuple<ArrayList<Vertex<T>>, Double> minimalPath( Vertex<T> src, Vertex<T> dest ) { ArrayList<Tuple<Pair<Vertex<T>>,Double>> verticesInPath = new ArrayList<Tuple<Pair<Vertex<T>>, Double>> (); ArrayList<Vertex<T>> visitedVertices = new ArrayList<Vertex<T>> (); final Comparator pathCostCompara...
68008d10-c753-449c-bf4d-941801aae72d
0
public JTextField getNumberOfPointsTextField() { return numberOfPointsTextField; }
915418c1-01fe-4c95-b78a-74c347bd93cc
3
public ExameDAO getExame(){ try{ EntityManager em = conecta(); if (em!=null){ String consulta = "SELECT e FROM Exame e WHERE e.idExame="+idExame; //System.out.println(consulta); Query q = em.createQuery(consulta); List<Exame...
681dd062-cd55-4437-9985-b3752ab43093
6
public static int numPandigital() { int ret = 0; HashSet<Integer> hs = new HashSet<Integer>(); String temp; for (int i = 2; i < 10000; i++) { for (int j = i; j < 10000; j++) { temp = i + "" + j + (i * j); if (temp.length() > 9) { break; } if (temp.length() == 9 && !hs.contains(i * j)) { ...
c2ae87ec-9a0e-4b0d-b4eb-946d80e8cb16
8
public void endElement(String namespaceURI, String localName, String rawName) throws SAXException { if (rawName.equals("authors")) { publication.addAuthor(content); } else if (rawName.equals("title")) { publication.setTitle(content); } else if (rawName.equals("school")) { publication.setSchool(content...
e3ed9273-9e7f-4abf-9bd6-edf3b8767a94
2
public static void robarFicha(boolean humano){ if (Domino.listaFicha.size()!=0){ int n = (int) Math.floor(Math.random() * Domino.listaFicha.size()); // int cabeza = this.listaFicha.get(n).getCabeza(); // int cola = this.listaFicha.get(n).getCola(); // this.listaFicha...
64253b70-67dc-45f9-af58-c4616885f900
2
private boolean write (Pipe pipe_, Msg msg_) { if (!pipe_.write (msg_)) { Utils.swap(pipes, pipes.indexOf (pipe_), matching - 1); matching--; Utils.swap(pipes, pipes.indexOf (pipe_), active - 1); active--; Utils.swap(pipes, active, eligible - 1); ...
47232b7a-da67-42b4-9b4f-b1b80d85178f
6
@Override public int getSize() { return opcode==XOpcode.LOADB?2:opcode==XOpcode.LOADS||opcode==XOpcode.LOADI||opcode==XOpcode.LOADF||opcode==XOpcode.LOADD||opcode==XOpcode.LOADT?3:1; }
6132b88c-140b-4377-b96d-8300fcee9c40
3
@Override public void mousePressed(MouseEvent e) { mX = e.getX(); mY = e.getY(); pX = (int) Math.floor((mX - Game.MAPOFFX) / (double) Game.TILESIZE) + Game.xOff; pY = (int) Math.floor((mY - Game.MAPOFFY) / (double) Game.TILESIZE) + Game.yOff; switch(e.getButton(...
2bb80887-750d-48a7-8507-9e75fd62d289
2
public int searchInsert(int[] A, int target) { int l = 0, r = A.length - 1; while(l <= r){ int m = (l+r) >> 1; if(A[m] < target) l = m + 1; else r = m - 1; } return l; }
27fa4de2-1b52-465e-bbfc-b4f709317b56
4
public JSONObject toJSONObject(JSONArray names) throws JSONException { if (names == null || names.length() == 0 || this.length() == 0) { return null; } JSONObject jo = new JSONObject(); for (int i = 0; i < names.length(); i += 1) { jo.put(names.getString(i), this....
2685c5e8-a946-462f-a9e5-455223e0dc44
8
@Override public synchronized void run() { try { BufferedReader in = new BufferedReader(new InputStreamReader(socket.getInputStream())); BufferedOutputStream out = new BufferedOutputStream(socket.getOutputStream()); String line = in.readLine(); if (line == null) { logger.error("Received invalid file...
dd0757bc-23d4-477b-b84d-0f5a71329b30
9
public double getPolarityIndex(String text) throws APIErrorException { // API settings String APIkey = "your_api_key"; String language = "eng"; String categories = "sentiment"; // Encodes text try { text = URLEncoder.encode(text,"ISO-8859-1"); } catch (UnsupportedEncodingException e) { e.print...
8a52d7cc-29e6-44c7-b87e-1216f5e7b3ab
2
public void loadAccounts () { try { BufferedReader freader = getAccountFile(); String str; while ((str = freader.readLine ()) != null) { Accounts.add (str.split (" ")); } } catch (Exception ex) { ex.printStackTrace (); } }