method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
a6a876ca-cf7a-4a71-9fd3-28ab53df1283
7
public void captureScreen() { screen = Control.robot.createScreenCapture(new Rectangle(Toolkit.getDefaultToolkit().getScreenSize())); int screenStartX = 0; int screenStartY = 0; boolean windowTopEncountered = false; //draw down from top center until you see the window color. for(int y = 0; y < 500; y++) ...
8378025e-c71c-4966-b177-23c75b0ac553
2
public Cell getCellByIndex(Integer index) { if(cells != null && !cells.isEmpty()) { return cells.get(index); } return null; }
790cc95d-d882-4281-b4ca-be454d565075
3
public void update() { if (startGame.contains(MouseMotListener.mouse)) { hoveringStart = true; } else { hoveringStart = false; } if (options.contains(MouseMotListener.mouse)) { hoveringOptions = true; } else { hoveringOptions = false; } if (exitGame.contains(MouseMotListener.mouse)) { ...
713bbaa7-8628-4ef8-90e3-888e6cd801b7
8
public LinkedList<GraphAgent> getGraphAgents(){ LinkedList<GraphAgent> _agents = new LinkedList<GraphAgent>(); XmlIO _xmlio = new XmlIO(); _xmlio.readFile(_filename+".xml"); Document _doc = _xmlio.getDocument(); NodeList _xmlNodes = _doc.getElementsByTagName("agent"); for(int i=0;i<_xmlNodes.getLen...
ce9e6885-7134-45cc-a90f-5821775d0f19
3
public Program loadCodes() { Program program = new Program(); String line; try { while ((line = source.readLine()) != null) { StringTokenizer tokenizer = new StringTokenizer(line); List<String> argumentList = new ArrayList<String>(); By...
6a030b96-7a85-4070-8d1b-50c8ebd9841a
9
void analyze(String his, String myHis){ //ammo analysis first for(int i = 0; i < his.length(); i++){ int hisAmmo = findAmmo(his.substring(0, i)); int myAmmo = findAmmo(myHis.substring(0, i)); boolean match = false; for(Choice c : ammoAnalysis){ if(c.hisAmmo == hisAmmo && c.myAmmo == myAmmo && c...
6e170c7b-4e75-445d-a82e-dc0ea56cccd3
5
private PropertyResourceBundle readProperties(final String type) { PropertyResourceBundle bundle = null; File messagesFile = new File(this.getDataFolder(), type + lang + ".properties"); if (!messagesFile.exists()) { try { Utils.copy(getResource(type + lang + ".propert...
a79c9d22-35cc-4660-bcaa-57163624677d
7
public boolean resetStream( AudioFormat format ) { // make sure the Mixer exists: if( errorCheck( myMixer == null, "Mixer null in method 'resetStream'" ) ) return false; // make sure a format was specified: if( errorCheck( format == null, ...
aab9c7ce-4fc3-410c-8988-ba294a682345
9
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 = maxN...
b085eb2a-4f9b-456f-be68-ce2016fbd068
4
public void paint(GC gc, int width, int height) { if (!example.checkAdvancedGraphics()) return; Device device = gc.getDevice(); gc.setLineWidth(20); gc.setLineJoin(joinValues[joinCb.getSelectionIndex()]); // set the foreground color or pattern Pattern pattern = null; if (shapeColor.getBgColor1() != null) { ...
5344ea37-754c-47d3-9822-f901b3c4868e
2
public List<WorldName> getWorldNameById(String lang, String id) { List<WorldName> worldNames = new ArrayList<WorldName>(); List<WorldName> result = new ArrayList<WorldName>(); worldNames = sendRequest(lang); for(WorldName worldName : worldNames) { if(worldName.getId().equals(id)) { result.add(worldName);...
df55a7c4-191c-4908-b63a-618099930a40
4
public void remove(int offs, int len) throws BadLocationException { // return immediately when selecting an item if (selecting) { return; } if (hitBackspace) { // user hit backspace => move the selection backwards // old item keeps being selected ...
d10ed49b-abb0-4fd1-bb55-ca3c87bedca3
8
@Override public void run() { String nazovSuboru = pathFrom; InetAddress ip; try { ip = InetAddress.getByName("localhost"); File file = new File(pathTo); soket = new DatagramSocket(); byte[] buf = nazovSuboru.getBytes(); DatagramPacket paket = new DatagramPacket(buf, buf.length, InetAddres...
aef189e0-ea3c-4853-925c-51071682503a
3
public static String lTrim(String s) { char c[] = s.toCharArray(); int j = 0; loop: for (int i = 0; i < c.length; i++) { if (c[i] != ' ') { j = i; break loop; } } char c1[] = new char[(c.length - j)]; for (int i = 0; j < c.length; j++, i++) { c1[i] = c[j]; } s = new String(c1); return...
e53e013d-4a1d-4178-a996-c0c0502c4db3
1
public BoardTypeEnum getSelectedBoardType() throws GOLException { int i = comboBoard.getSelectionIndex(); if (i == -1) { throw new GOLException("Bitte Art des Spielbretts auswählen."); } else { return availableBoardTypes[i]; } }
2fe976e5-a193-465d-aef9-2870d5510042
8
public Picture getImage() { Color[][] col = new Color[h][w]; Color c; int r=0; int g=0; int b=0; for (int i=0; i<green.length; i++) { for (int j=0; j<green[0].length; j++) { for (int k=0; k<green[0][0].length; k++) { if (green[i][j][k]==1) { g = k; ...
07545567-de83-444d-9159-5476f8ae2255
5
public void stClickKey(int sleepTime, String... args) { try { Interpreter In = new Interpreter(); try { In.set("rb2", new Robot()); In.eval("rb2.mouseMove(70,515" + ");"); for (String s : args) In.eval("rb2.keyPress(java.awt.event.KeyEvent." + s + ");"); for (String s : args) In.eval("...
9c5c25ad-0712-42d0-81b3-764529cb6635
4
public Drawing getDrawing() { boolean test = false; if (test || m_test) { System.out.println("GameWindow :: getDrawing() BEGIN"); } if (test || m_test) { System.out.println("GameWindow :: getDrawing() END"); } return m_drawingControl; }
62e536ae-bb27-4c70-be45-4b180053e15f
8
public boolean isHidden() { Connection conn = null; ResultSet rs = null; PreparedStatement ps = null; try { conn = iConomy.getiCoDatabase().getConnection(); ps = conn.prepareStatement("SELECT hidden FROM " + Constants.SQLTable + " WHERE username = ? LIMIT 1"); ps.setString(1, thi...
da1504ab-efd6-4a67-9b23-7337b65814fb
3
static Object[] getPort(Session session, int rport){ synchronized(pool){ for(int i=0; i<pool.size(); i++){ Object[] bar=(Object[])(pool.elementAt(i)); if(bar[0]!=session) continue; if(((Integer)bar[1]).intValue()!=rport) continue; return bar; } return null; } ...
9a67f30c-b1ef-4ae8-9b27-066215097073
9
public void remove(){ OptionView temp=null; SavedEntityState state=null; View grand=getSuperview(); for(int i=0;i<grand.getSubviews().size();i++) if(grand.getSubviews().get(i)instanceof OptionView) temp=(OptionView)grand.getSubviews().get(i); for(int i=0;i<getS...
06318f28-9590-4f85-94d4-d4ce3867ec43
0
public int getColumnCount() { return columns; }
33d148cc-0c8a-44bc-a59d-beeb198e9138
5
private void removed (DeviceImpl dev) { if (Linux.trace) System.err.println ("notify remove " + dev); // call synch'd on devices for (int i = 0; i < listeners.size (); i++) { USBListener listener; listener = (USBListener) listeners.elementAt (i); try { listener.deviceRemoved (dev); } c...
23bf28ef-c001-4add-966a-f97dbfabc8e8
7
public static boolean unzipJar(final File destination, final File jarFile, final List<String> exclude) { try { if(!isZipValid(jarFile)) { return false; } final JarFile jar = new JarFile(jarFile); for(final Enumeration<JarEntry> enums = jar.entries(); enums.hasMoreElements();) { final JarE...
31bfb28c-0792-4d5f-b29c-6f86c87e917c
9
private static List<Integer> GetChain( int number, int root, HashSet<Integer> previousTerms, HashMap<Integer, Integer> nextNumberMemo) { if (_maxTerm < number) { return null; } boolean isAlreadyThere = previousTerms.contains(number); ...
ffa69e92-7eb2-4307-8d5f-79bb23c6e821
0
public static String getHTTPTime(int days) { Calendar calendar = Calendar.getInstance(); SimpleDateFormat dateFormat = new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss z", Locale.US); dateFormat.setTimeZone(TimeZone.getTimeZone("GMT")); calendar.add(Calendar.DAY_OF_MONTH, ...
c25280b3-467b-4fea-b02b-f7d2012aea04
1
public void paintComponent(Graphics g) { if (image == null) { image = createImage(getSize().width, getSize().height); graphics2D = (Graphics2D) image.getGraphics(); graphics2D.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); ...
6f6a8799-49ea-42ba-9aa0-a8780d6eb83f
8
public void generateTerrain(int par1, int par2, byte[] par3ArrayOfByte) { byte b0 = 4; byte b1 = 16; byte b2 = 63; int k = b0 + 1; byte b3 = 17; int l = b0 + 1; this.biomesForGeneration = this.worldObj.getWorldChunkManager().getBiomesForGeneration(this.biomesF...
d2925a42-ea34-4028-8fb4-515a724f3f92
1
public PerlinNoise2D(long seed) { Random random = new Random(seed); for (int i = 0; i < 256; i++) { mTable[256 + i] = mTable[i] = random.nextInt(256); } }
1f78b19d-82af-42c5-856e-d5cd0bd6a541
6
@Override public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) { if(args.length == 0) { sender.sendMessage(ChatColor.BLUE + bar + "====="); sender.sendMessage(ChatColor.GREEN + "KarmicLotto v" + plugin.getDescription().getVersion()); sender.sendMessage(ChatColor...
7e02567f-b37b-4a5f-9469-3ae73a20c305
0
public void setArtikel(Artikel artikel) { this.artikel = artikel; }
7addf788-5edb-4498-b162-824628e5d021
4
public String[] getRanges() { if( (cRangeList == null) && (ooxmlranges != null) ) { if( ooxmlranges.length > 0 ) { return ooxmlranges; } } String[] s = new String[cRangeList.size()]; for( int i = 0; i < s.length; i++ ) { s[i] = ((PtgArea) cRangeList.get( i )).getLocation(); s[i] = String...
34a7d558-1daf-4635-aced-9e307e0e0070
0
public static void main(String[] args) { //test search int[]test={2,5,6,4,4,0},test1={7,3,8,0,6,5,7,6,2}; MaximumNumber maximumNumber=new MaximumNumber(); System.out.println(Arrays.toString(maximumNumber.search(test, 6))); System.out.println(Arrays.toString(maximumNumber.search(t...
da55402f-595a-4439-ae53-6f5c18c32738
0
@Id @Column(name = "id") public int getId() { return id; }
0c95b022-04c0-47d2-8d84-78055f223f20
1
public void start() { setupOpenGL(); setupQuad(); selected = new Level("level1.txt"); Level.state=1; while (!Display.isCloseRequested()) { input(); update(); Display.sync(60); Display.update(); } destroy(); }
01e01786-d897-42d3-85bd-35141caaaa70
3
public ListNode deleteDuplicates(ListNode head) { ListNode dummy = new ListNode(0); dummy.next = head; ListNode p = dummy; if(head == null) return head; int cur = head.val+1; while(p.next != null){ if(p.next.val != cur){ cur = p.next.val; ...
e532d526-1287-4c01-9e0f-44411b980490
2
public void visitIfStmt(final IfStmt stmt) { if (stmt instanceof IfCmpStmt) { visitIfCmpStmt((IfCmpStmt) stmt); } else if (stmt instanceof IfZeroStmt) { visitIfZeroStmt((IfZeroStmt) stmt); } }
f87035e1-e3f9-4975-9da6-3cb99f8045cb
7
public File copy(String filepath, InputStream in) { File file = new File(filepath); if (!file.exists()) { OutputStream out = null; try { out = new FileOutputStream(file); byte[] buf = new byte[1024]; int len; try { ...
328ca782-62b7-4b25-b436-71e04ad02ecd
5
public void initialize(int pieceLength,BitMap bm) throws IOException{ this.pieceLength = pieceLength; this.leftPiece = (int) (byteOffSet/pieceLength); this.rightPiece = (int) Math.ceil((double)(byteOffSet+length)/pieceLength)-1;//len 0? numPieces = rightPiece - leftPiece + 1; f = new File(topFolder+"\\"+pathA...
76ef05e1-dd33-41d7-bd70-2f7b0f302fe7
3
public void loadPatientData(){ PatientLogic myLogicLayer=new PatientLogic(); List<Patient> patientList=new ArrayList(); DefaultTableModel patientDataTable=new DefaultTableModel(); Object[ ] columnNames=new Object[6]; Object[ ] fieldValues=new Object[6]; Patient myPatient=n...
679673b8-5c66-4939-8bdb-cb047a8f2afa
1
Fraction(int numerator, int denominator){ if(denominator == 0){ throw new IllegalArgumentException("denominator must be non-zero"); } this.numerator = numerator; this.denominator = denominator; reduction(); }
7f03cde2-c7ef-4eb4-9c8f-f10509b0994a
2
public int getPlayerPositionOffset(GuessTheNumberPlayer p) { int offset = 0; Position position = p.getPosition(); switch(position) { case North: offset = 2; break; case South: offset = 0; break; } return offset; }
bb7d146a-00a5-41c5-b639-1c32ec1ed87e
1
private void testBoolean(DateTimeField fieldA, DateTimeField fieldB, String method, long millis, boolean boolA, boolean boolB) { if (boolA != boolB) { failBoolean(fieldA, fieldB, method, millis, boolA, boolB); } }
8eaf2f5f-1e6c-4fb2-a081-c8c2c36ac120
2
private String getComponentClassName(String id) { if (id.indexOf('.') == -1) { String cn = getName_ClassMap().get(id); if (cn == null) { throw new ComponentException("Unknown component name: " + id); } return cn; } return id; }
bf6cadef-c261-481d-98d7-20727789f07b
5
public WaterCreep(int id){ if (id > 0 && id < 4){ if (id == 1){ maxHp = 50; armor = 10; speed = 3f; }else if (id == 2){ maxHp = 500; armor = 15; ...
4375334a-23e9-4008-b72d-0a868783dc39
6
@EventHandler public void SilverfishHeal(EntityDamageByEntityEvent event) { Entity e = event.getEntity(); Entity damager = event.getDamager(); String world = e.getWorld().getName(); boolean dodged = false; Random random = new Random(); double randomChance = plugin.getSilverfishConfig().getDouble("Silverfis...
96e56254-1d36-497d-b300-caf0a29c09d7
7
public static Room createLonelyRoom(Area A, Room linkTo, int dir, boolean copyThisOne) { Room newRoom=null; final String newRoomID=A.getNewRoomID(linkTo,dir); if(newRoomID.length()==0) return null; if((copyThisOne)&&(linkTo!=null)) { CMLib.map().resetRoom(linkTo); newRoom=(Room)linkTo.copyOf(); f...
96193755-5379-4f17-b937-532fdfd59186
3
private Unit getAppCntxtInsPt(){ for(Unit u : b.getUnits()){ Iterator it = u.getUseBoxes().iterator(); while(it.hasNext()){ Value v = ((ValueBox)it.next()).getValue(); if(v instanceof IdentityRef){ //includes ThisRef and ParameterRef continue; } else{ return u; } } } return...
1ba02282-03bb-4be4-be73-e11e22ea3bf8
4
public void entrenar(String[][] entradas){ boolean finalizado = false; int Pw,error, y; this.numeroEpocasFinal = 0; while(!finalizado){ finalizado = true; for(int n = 0; n < entradas.length; n++){ Pw = this.desicion(entradas[n]); y = Integer.valueOf(entradas[n][entradas[n].le...
273bfd9b-5e6f-40b0-a823-153886750c64
1
public EquivalenceList deserialize(JsonElement json, Type type, JsonDeserializationContext context) throws JsonParseException { EquivalenceList equivalenceList = new EquivalenceList(); JsonArray jsonArrayOfEquivalences = json.getAsJsonArray(); for (int i = 0; i < jsonArr...
3807739e-2114-482a-b9c9-a25a8dbcaafd
1
void add(String s, Object resHolder) { try { parser.addOption(s, resHolder); } catch (Exception e) { e.printStackTrace(); System.exit(1); } }
75d21a13-48b7-4d5b-8503-f27f96de921a
0
protected void setCenter() { Dimension screen = this.getToolkit().getScreenSize(); Dimension login = this.getSize(); this.setLocation((screen.width - login.width) / 2, (screen.height - login.height) / 2); }
b5c544de-692e-45bf-8e8a-233f2b3362bb
0
public static int expGain(int uLevel, int eLevel) { return 20; }
01c4c29b-6fb7-46ea-9bb0-0fd08cfd788e
4
public Automaton intersection(Automaton aut) { Automaton a = new Automaton(); a.m_Start.addAll(this.m_Start); a.m_Start.addAll(aut.m_Start); a.m_Final.addAll(this.m_Final); a.m_Final.addAll(aut.m_Final); //zorgen dat begin en eind gekend zijn ArrayList<Integer> rstart = ...
886a185a-c706-434a-bd81-05a3d54db77b
2
public boolean isThere (String aword) { int index = 0; while (index < quantity && !list[index].equals(aword)) { index++; } return index < quantity; }
ca96ffa5-1646-42cd-9208-11986cd7fbba
9
@SuppressWarnings("unchecked") // generic entries public void dispatch(HttpServletRequest req, HttpServletResponse resp) { try { final List<HandlersMappingEntry<?>> mapping; if("GET".equals(req.getMethod()) || "HEAD".equals(req.getMethod())) mapping = registryGet; else if...
b28c38d6-5b12-4898-ae43-8889523ec1cb
5
public static Level LoadLevel(File f){ saveFile = new YAMLFile(true); saveFile.Load(f); Level level = new Level(saveFile.getInt("levelWidht"), saveFile.getInt("levelHeight"), saveFile.getString("levelName")); Game.get().ppb_x = 800 / level.getWidth(); Game.get().ppb_y = 800 / level.getHeight(); for...
e34e87a8-3dbf-435b-a0b1-74c3786e9112
5
@Override public String toSql(String tblName,List<String> headers,List<String> columns, HashMap<String,ForeignKey> foreignKeys) {; StringBuilder builder = new StringBuilder(); builder.append("INSERT INTO "); builder.append(tblName); builder.append("("); for(int i = 0 ; i < headers.size() ; i++){ builde...
7b8d6a93-477c-4a1b-b4ae-bea9acff4af0
3
private String formatLcdValue(final double VALUE, final int DECIMALS) { decBuffer.setLength(0); decBuffer.append("0"); if (DECIMALS > 0) { decBuffer.append("."); } for (int i = 0; i < DECIMALS; i++) { decBuffer.append("0"); } if (SCIFI_F...
202a62cd-db95-404a-9263-7c1513850847
3
public boolean isNull() { try { for (int i = 0; i < getFieldsNumber(); i++) { if (getElementAt(i + 1) != 0) { return false; } } } catch (OutOfBoundsException e) { e.printStackTrace(); } return true; }
7ed6ce8a-8f1a-45fa-8002-1ec5ae8ff589
9
public boolean equals( Object obj ) { if( obj == null ) { return( false ); } else if( obj instanceof GenKbMimeTypeBuff ) { GenKbMimeTypeBuff rhs = (GenKbMimeTypeBuff)obj; if( getRequiredMimeTypeId() != rhs.getRequiredMimeTypeId() ) { return( false ); } if( ! getRequiredName().equals( rhs.getReq...
dda99d57-4275-417f-a82e-b2df3de758d9
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 fe...
e143dfaa-dfcb-4312-8079-56a640b50748
6
public List<ItemStack> getItems() { // Drop air? I think not. if (item.getType() == Material.AIR) return null; // Calculate the number of items to create int count = amountDiff > 0 ? RandomUtil.i.nextInt(amountDiff + 1) + item.getAmount() : item.getAmount(); int damage = damageDiff > 0 ? RandomUtil.i.n...
85c37080-46a3-495e-ae12-9d2ec04d21ba
7
public GuiSlotStatsBlock(GuiStats var1) { super(var1); this.field_27274_a = var1; this.field_27273_c = new ArrayList(); Iterator var2 = StatList.objectMineStats.iterator(); while (var2.hasNext()) { StatCrafting var3 = (StatCrafting) var2.next(); boolean v...
88f40b53-c31e-489a-8bb7-5dd009eae955
7
private static HashMap<String, Integer> getCountsForTaxaAtLevel( String rdpFile, String level) throws Exception { HashMap<String, Integer> map = new HashMap<String,Integer>(); BufferedReader reader = new BufferedReader(new FileReader(new File( rdpFile))); for(String s= reader.readLine(); s != null; ...
f853e997-b5fa-43d1-9914-5bfa28ba80cc
3
public void analzarLexico() { lectura.setCad(cadena); String cad = lectura.getToken(); int s; while (cad != null) { cad = cad.trim(); // System.out.println(cad); if (cad.length() > 0) { s = this.dt.valueofCadEquals(cad); // ...
6f4d28ff-2088-4699-b251-744166ea6a20
4
public String cyclify() { final StringBuffer result = new StringBuffer("("); for (int i = 0; i < super.size(); i++) { E object = this.get(i); if (object == null) { throw new RuntimeException("Invalid null element after " + result + " in " + this); } if (i > 0) { result.ap...
798c6e42-cdcb-4af4-b8a4-b2e36f5fc4d7
4
private static int packet_get_samples_per_frame(byte[] data, int fs) { int audiosize; if ((data[0]&0x80) != 0) { audiosize = ((data[0]>>3)&0x3); audiosize = (fs<<audiosize)/400; } else if ((data[0]&0x60) == 0x60) { audiosize = ((data[0]&0x08) != 0) ? fs/50 : f...
9272d661-eb57-4de3-8a9a-97f8f9846993
1
@Override public void testFailure(Failure failure) { setCurrentFailure(failure); final String message = failure.getMessage(); if (message != null) { logger.error("END Testcase '{}' '{}' FAILED because '{}'.", new Object[] {getId(failure.getDescription()), fail...
b1b67602-0f9e-4d11-af89-1b3d1125e289
0
public String getId() { return id; }
0f0bae71-1b09-4a8e-8e15-9f02148189ba
2
private void isLessThanString(String param, Object value) { if (value instanceof String) { if (param.compareTo((String) value) > 0) { throw new IllegalStateException("String is not greater than supplied value."); } } else { throw new IllegalArgumentException(); } }
86f0091d-8d09-4f3d-99e8-01e5b6e97ac7
8
private static void sortCellsByRadio() { String fileName = "/Users/Johan/Downloads/cell_towers.csv"; try(BufferedReader br = new BufferedReader(new FileReader(fileName)); BufferedWriter bw_UMTS = new BufferedWriter(new FileWriter("/Users/Johan/Documents/CellTowers/cell_towers_UMTS.csv", true)); BufferedWrit...
12e2862a-dd25-4f00-a8d7-e56bf49d6bec
9
protected Set<NucleotideInteraction> parseInteractions( Map<String, Sequence> aSequenceMap, File aPdbFile) throws IOException { Set<NucleotideInteraction> interactions = new LinkedHashSet<NucleotideInteraction>(); for (String chain : aSequenceMap.keySet()) { Nucleotide previousNucleotide = null; for (...
328e4086-6b10-4b24-b23d-5f7ed232b1a8
4
public double standardizedPersonMaximum(int index){ if(!this.dataPreprocessed)this.preprocessData(); if(index<1 || index>this.nPersons)throw new IllegalArgumentException("The person index, " + index + ", must lie between 1 and the number of persons," + this.nPersons + ", inclusive"); if(!this.va...
1b8fd821-856f-46e3-88a9-d2c10df47234
6
private int mixLightnessSigned(int hsl, int lightness) { if (hsl == -2) return 0xbc614e; if (hsl == -1) { if (lightness < 0) lightness = 0; else if (lightness > 127) lightness = 127; lightness = 127 - lightness; return lightness; } lightness = (lightness * (hsl & 0x7f)) / 128; if (light...
536b7086-6fc9-4da6-b44b-21481efa3f17
3
public byte[] insererTableau(byte[] debut,byte[] fin){ ArrayList<Byte> tmp = new ArrayList<Byte>(); for(int i = 0;i<debut.length;i++){ tmp.add(debut[i]); } for(int j =0;j<fin.length;j++){ tmp.add(fin[j]); } byte[] aRetourner= new byte[tmp.size()]; for(int k =0;k<tmp.size();k++){ aRetourner[...
9f8261e8-b928-4b2d-aedf-2bc4ad78a1b9
9
public static void main(String[] args) throws IOException { /*boolx[] kmap = { boolx.F,boolx.F,boolx.T,boolx.F , boolx.T,boolx.T,boolx.T,boolx.F , boolx.F,boolx.T,boolx.T,boolx.T , boolx.F,boolx.T,boolx.F,boolx.F }; Utility.rep4varKmap(kmap); System.out.print...
5a12b841-b6c4-45c3-bb82-7ff9b027e433
0
public void lookAt(SimpleVector obj) { cam.lookAt(obj); }
f6bd2349-3bcd-45f5-9645-bddf12b6aaa4
8
public static void main(String[] args) { KeyboardReader r = new KeyboardReader(); Employee emp; //employee String name; //name int type; //type double rate; //hourly pay rate int hours; //hours worked String prompt; //user prompt; emp = new Employee(); ...
eedbd7f6-2430-45fb-b753-7da2655915d8
9
private String[] getEnabledProtocols(SSLEngine engine, String requestedProtocols) { String[] supportedProtocols = engine.getSupportedProtocols(); String[] enabledProtocols = null; if (requestedProtocols != null) { Vector<Object> vec = null; String tab[] = requestedProtocols.trim().split("\\s*,\\s*"); i...
90a47bd3-9617-4b9c-99e9-742476ada122
3
public void run() { long counter = System.currentTimeMillis(); while (running) { update(); render(); updates++; frames++; if (System.currentTimeMillis() - 1000 >= counter) { System.out.println("Updates: " + updates + " | Frames: " + frames); counter = System.currentTimeMillis(); frame...
5b373aec-6388-4f4e-9f7f-b189ff18728c
5
private void createDataset() { this.gson = new Gson(); Map<?, ?> all = this.transitionsStore.getAll(); Collection<String> allTransitions = (Collection<String>) all.values(); for (String transitionString : allTransitions) { if(isPending(transitionString) | isACKED(transitionString)){ Object deseri...
ebd7c498-148f-4986-87aa-9d32de56ac4e
5
@Test public void testLampState() { for (LampState state : LampState.values()) { switch (state) { case OFF: assertThat(state.getSimpleDisplay(), equalTo("O")); break; case RED: ass...
3795070a-c178-4df4-92c3-000136b71a65
1
private void drawStringLine(String str, SpriteSheet font, double x, double y, double scale, Color color) { double aspect = font.getSpriteAspect(); double startX = x; double startY = y; double width = scale * aspect; double height = scale; for (int i = 0; i < str.length(); i++, startX += width) { char ...
e51223e1-51ff-4671-92c6-aff6cf8ec6ec
9
@Override public void initialize(URL url, ResourceBundle rb) { // Check if defautl server is set if (null == manager.getDefaultServer()) { // No default server set. must be first run. logger.finer("server is not set"); try { ...
44905e62-6607-427b-a370-1bd628e71747
1
public Tester(String name) { this.name = name; }
35e0a0ba-4bbc-47c4-b890-f85d60a33813
9
private void cftbsub(int n, double[] a, int offa, int[] ip, int nw, double[] w) { if (n > 8) { if (n > 32) { cftb1st(n, a, offa, w, nw - (n >> 2)); if ((ConcurrencyUtils.getNumberOfThreads() > 1) && (n > ConcurrencyUtils.getThreadsBeginN_1D_FFT_2Threads())) { ...
7a09a9b2-bf30-4f97-9de3-bd5939d3c4a4
7
public void print(int depth) { int i; // Print the indentation and the data from the current node: for (i = 1; i <= depth; i++) System.out.print(" "); System.out.println(data); // Print the left subtree (or a dash if there is a right child and no left child) if...
6163eb0e-8092-4cf1-a02f-e32a14edcfc8
1
public static Client getInstance(){ if (client == null) client = new Client(); return client; }
af006aed-3aa0-419c-8afb-41fc09e1223c
3
@Override public int open(JoeTree tree, DocumentInfo docInfo, InputStream stream) { // Set the objects we are going to populate. this.docInfo = docInfo; this.tree = tree; // initialize result flags int success = FAILURE; errorOccurred = false; // try to read the file try { // we'll be grabbing...
63c18115-a7d6-4cff-9b93-7d7e79431fde
2
public static int[][] inverse(int[][] array) { int[][] out = new int[array[0].length][array.length]; for (int line = 0; line < array.length; line++) { for (int data = 0; data < array[0].length; data++) { out[data][line] = array[line][data]; } } return out; }
3bb903f4-e478-4cb2-8bb1-53456ecb0054
7
public void showPopup(){ String title = ""; if(this.newEintrag) title = "Create Entry"; else title = "Edit Entry"; int result = JOptionPane.showConfirmDialog(null, pane, title, JOptionPane.OK_CANCEL_OPTION, JOptionPane.PLAIN_MESSAGE); if (result == JOptionPane.OK_OPTION) { if (!stringField....
b8cee9d4-1c63-416d-bc47-6414152e6d76
2
private void push(JSONObject jo) throws JSONException { if (this.top >= maxdepth) { throw new JSONException("Nesting too deep."); } this.stack[this.top] = jo; this.mode = jo == null ? 'a' : 'k'; this.top += 1; }
ca10b44a-49f6-4e00-b5d9-346535041a1b
1
public static Properties initProperties(String propertyFile) { Properties properties = new Properties(); try (InputStream is = new FileInputStream(propertyFile)) { properties.load(is); } catch (IOException ex) { System.out.println(String.format("Could not locate the %1$s file.", propertyFile)); ...
eb42fdca-9463-42a6-9718-09982cc00073
7
public static void main(String[] args) throws Exception { HashMap<String, String> map = getDiseaseExtentMap(); for(String s : map.values()) System.out.println(s); OtuWrapper wrapper = new OtuWrapper(ConfigReader.getBigDataScalingFactorsDir() + File.separator + "July_StoolRemoved" + File.separa...
7217361d-c9ff-445f-94a8-d97ed186363f
7
public Pc toNearPc(int line) { int n = tableLength(); int nearPc = 0; int distance = 0; if (n > 0) { distance = lineNumber(0) - line; nearPc = startPc(0); } for (int i = 1; i < n; ++i) { int d = lineNumber(i) - line; if ((d...
a1c2ea80-7adc-4e3f-81eb-e8c90fc635d7
0
@Test public void testGetS1() { System.out.println("getS1"); Sense instance = new Sense(Sense.senseDir.HERE, 3, 6, Sense.condition.FOE); int expResult = 3; int result = instance.getS1(); assertEquals(expResult, result); }
b078f8ed-14ac-4ec3-875b-877388a70db2
6
public void mergeTerrainAndBackground(int x,int y,int width,int height){ int[] terrainPixels = getPixels(); int realY = y * getWidth(); for (int i = 0; i < width; i++) { for (int j = 0; j < width; j++) { int adr = realY + x + i * getWidth() + j; if ((j + x) > getWidth() | (j + x) < 0 || (y + i) < 0 |...
81fa3bc6-f055-4760-860e-6fd89a2a2c2a
5
private void RGBto(){ this.bufferImageTemp=ObjTransformFormats.iconToBufferedImage(this.jLabelImage.getIcon()); switch(jComboBox_RGB.getSelectedItem().toString()){ case "GBR": this.bufferImageTemp=ObjBasicFilters.RGBto(this.bufferImageTemp, Ima...
3e4fb90b-963d-4baf-9a07-fc1ae18566f9
3
@Override public void actionPerformed(ActionEvent ae) { // Pop up a file dialog FileDialog open = new FileDialog(app); open.setVisible(true); // Assign directory and file to single variable for convenience String path = open.getDirectory() + open.getFile(); try{ // Create file FileWriter...