method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
6f9765c2-e9c8-4a20-97ca-3954f1b536ac | 8 | public static boolean matches(String ptn, String src) {
if (src.equals(ptn))
return true;
else if (ptn.charAt(0) == '#') {
return Pattern.matches(ptn.substring(1), src);
} else if (ptn.charAt(0) == '*' && ptn.charAt(ptn.length() - 1) == '*') {
ptn = ptn.substring(1, ptn.length() - 1);
return src.conta... |
cde27922-128b-423e-8413-59dcaef15dde | 6 | public static void main(String args[]) {
/* Set the Nimbus look and feel */
//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
/* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
* For details see http://down... |
7bb74d63-9b94-4b5e-9316-de19fcb9acfc | 9 | public static boolean XMLPreserveWhiteSpace(Node element, TagTable tt)
{
AttVal attribute;
/* search attributes for xml:space */
for (attribute = element.attributes; attribute != null; attribute = attribute.next)
{
if (attribute.attribute.equals("xml:space"))
... |
559f374e-cea9-40dd-821f-65c5ebc1b6cd | 8 | @Override
public void process() throws Exception
{
Logger.getInstance().logDebug("NotifyQueueManager running...", null, null);
Notification notification = getNotifyQueue().take();
if (notification instanceof GatewayStatusNotification)
{
if (Service.getInstance().getGatewayStatusNotification() != nul... |
de611652-ae23-4f2f-8c7d-563b7a2a85d5 | 0 | public void setData(KeyDataType value) {
this.data = value;
} |
101bfb9f-8304-4f9e-9966-674c41cb8473 | 0 | @Test
public void testCreditCardStringInt() {
assertEquals("John Doe", this.card2.getCardHolder());
assertEquals(3000, this.card2.getCreditLimit());
assertEquals(0, this.card2.getBalance());
} |
5ccfe612-b52d-4d5f-ab6f-d3367c5441df | 5 | public boolean magicAttack(Monster theMonster){
System.out.println("How much damage would you like to do?");
System.out.println("Mana: " + this.getMana());
System.out.print("command: ");
Scanner input = new Scanner(System.in);
try{
String theMagicDamage = input.next();
int magicDamage = Integer.parseInt(t... |
4df4b978-3ba3-4be4-bdc1-db99f6d85b26 | 9 | public String execWithPars(Problem problem, String file)
{
String line = null;
try
{
Service service = null;
Host host = null;
if (problem != null) {
host = problem.getHost();
service = problem.getService();
}
String pluginOutput = "";
if (service != null)
pluginOutput = service.g... |
118daf63-8bf7-4b1b-8a06-c1d696a5ad35 | 8 | @Override
public void init(){
btnExit = new GameButton("X",GamePanel.WIDTH-60,10);
addComponent(btnExit);
btnExit.addButtonListener(new ButtonListener(){
public void buttonClicked() {
client.close();
client.stop();
... |
202846e4-63b8-458c-9d50-df5a7b8440c9 | 1 | private ImageProcessor doSmoothing(ImageProcessor minSuppres, ImageProcessor adjusted){
ImageProcessor adj = adjusted.convertToFloatProcessor();
ImageProcessor ip = minSuppres.duplicate();
adj.resetMinAndMax();
if(adj.getMax() > 0.0) adj.multiply(1.0/adj.getMax());
adj.resetMinAndMax();
ip.copyBits(adj, 0,... |
1c380bce-a595-46b1-901d-508c7d711fa2 | 5 | @Override
public void run() {
try {
while(!Thread.interrupted()) {
// Blocks until next piece of toast is available
Sandwich s = sandwichQueue.take();
// Verify that the sandwich is coming in order,
// and that all are jellied and p... |
bfcee8bd-f4e6-4994-826d-0c99aefe62fc | 2 | public static boolean createSuggestion(String subject, String description) {
Suggestion suggestion = new Suggestion();
suggestion.setSubject(subject);
suggestion.setDescription(description);
suggestion.setAuthor(FOTE.getUser().getId());
if (isValidSuggestion(suggestion))... |
aa88b917-6c94-40ae-8e47-fb0248d9fb77 | 7 | private boolean isEnnemyTouch(laser tmp){
vaisseau touche = null;
//si un vaisseau est sur le trajet
if ((touche = empire.containAndRetrieve((int) tmp.posFinx, (int) tmp.posFiny)) != null
|| (touche = republic.containAndRetrieve((int) tmp.posFinx, (int) tmp.posFiny)) != null) {
... |
de903c6b-d10d-4e6b-b0e2-db6ae3068ec8 | 0 | public SplitCell(ProcessedCell src, List<ProcessedCell> dst){
this.src = src;
this.dst = dst;
} |
4627a0bd-66e1-42b5-bc06-80a266b0c8e3 | 1 | public static void compexch(Comparable[] a, int i, int j)
{
if (less(a[j], a[i]))
exch(a, j, i);
} |
f6277213-5863-495e-9285-282cb315adcf | 3 | private void closest(CommandSender sender) {
if (!(sender instanceof Player)) {
noConsole(sender);
return;
}
if (!sender.hasPermission("graveyard.command.closest")) {
noPermission(sender);
return;
}
Player player = (Player) sender;
... |
dbe942b3-1bac-4bca-a797-062e654a2ec6 | 7 | public static Document deepCloneDocument(Document doc, DOMImplementation impl) {
Element root = doc.getDocumentElement();
Document result = impl.createDocument(root.getNamespaceURI(),
root.getNodeName(),
null);
... |
5eb298e0-49fe-47f3-9eb4-42a64d42b366 | 3 | public boolean chequeDateCheck(String currentDate){
this.currentDateSplit(currentDate);
if(year>=this.currentYear){
if(month>=this.currentMonth){
if(date>=this.currentDate){
return true;
}
}
}
return false;
} |
2e94ebea-1262-4c93-89cd-1701f5ce7b71 | 7 | public void run() {
while (active) {
int mod = timeElapsed % 5;
switch(mod)
{
case 0:
log.info("info level log.");
break;
case 1:
log.debug("debug level log.");
break;
case 2:
log.warn("warn level log");
break;
case 3:
log.error("error level log");
break;
case 4... |
e5235ab7-069c-423e-82aa-7e5c5a3a0155 | 4 | public void initBall() {
double[] a = coords.get("BALL");
a[DX] = speedX;
Random rand = new Random();
int temp = rand.nextInt(10);
if(temp < 5) {
a[DY] = 1;
}
if(temp > 5) {
a[DY] = -1;
}
if(temp == 5 || temp < 0) {
... |
dee983d3-09f3-4c6a-9e8f-fc50b18f369a | 9 | public static boolean writeWikiSample(BookmarkReader reader, List<Bookmark> userSample, String filename, List<int[]> catPredictions) {
try {
FileWriter writer = new FileWriter(new File("./data/csv/" + filename + ".txt"));
BufferedWriter bw = new BufferedWriter(writer);
int userCount = 0;
// TODO: check en... |
8101d630-e192-4ce0-b9cd-b021b6ccdcd0 | 4 | @Override
public boolean load() {
try {
DataInputStream dis = new DataInputStream(new BufferedInputStream(new FileInputStream(inputFileName)));
width = dis.readInt();
height = dis.readInt();
data = new float[height][width];
for (int i = 0; i < hei... |
938fa141-dacf-4fac-8024-e51a84d65eee | 9 | private static <T extends Comparable<T>> void printNodeInternal(List<TreeNode<T>> nodes, int level, int maxLevel) {
if (nodes.isEmpty() || BTreePrinter.isAllElementsNull(nodes))
return;
int floor = maxLevel - level;
int endgeLines = (int) Math.pow(2, (Math.max(floor - 1, 0)));
... |
0b5d083b-f431-4658-b338-49f5eb7e619a | 6 | private void refreshChannel() {
synchronized (this) {
OutputStream stream = new OutputStream();
stream.writeString(ownerDisplayName);
String ownerName = Utils.formatPlayerNameForDisplay(owner);
stream.writeByte(getOwnerDisplayName().equals(ownerName) ? 0 : 1);
if (!getOwnerDisplayName().equals(ownerNam... |
e218e8d3-2bdc-4d91-9eef-546d947c6ce6 | 9 | protected void service(HttpServletRequest req, HttpServletResponse res)
throws ServletException, IOException {
OutputStreamWriter wr = null;
InputStream in = null;
OutputStream out = null;
try {
Map<String,Object> reqMap = new HashMap<String,Object>();
... |
0ea38635-3cd1-4b7e-93bf-b58a8d18d2be | 6 | public static void main(String args[]) {
Scanner in = new Scanner(System.in);
int N = in.nextInt(); // the number of points used to draw the surface of Mars.
in.nextLine();
int LAND_X = 0;
int LAND_Y = 0;
for (int i = 0; i < N; i++) {
LAND_X = in.nextInt(); /... |
9f2e1b75-b936-408e-8e8c-20ca52b959fc | 9 | protected void linkProgram(List<VertexAttrib> attribLocations) throws LWJGLException {
if (!valid())
throw new LWJGLException("trying to link an invalid (i.e. released) program");
uniforms.clear();
// bind user-defined attribute locations
if (attribLocations != null) {
for (VertexAttrib a : attribLocati... |
62a8b8b4-77f6-42d8-ae07-67920b575526 | 9 | public static String insertLineBreaks(String message, int lineBreak,
String lineBreakSymbol, String padString, boolean breakBeforeLineBreak) {
StringBuilder sb = new StringBuilder();
StringTokenizer st = new StringTokenizer(message != null ? message : "",
" ");
if (st.hasMoreElements()) {
... |
3849809a-5dfc-4b7d-83d9-378d7aea0563 | 1 | protected void loadBean() throws IntrospectionException {
propertyMap = new HashMap<String, PropertyDescriptor>();
BeanInfo info = Introspector.getBeanInfo(beanClass);
PropertyDescriptor[] properties = info.getPropertyDescriptors();
for (int i = 0; i < properties.length; i++) {
... |
d526adec-f7d5-4b42-8489-bd40f7ee9798 | 9 | private void layoutContainerHorizontally(Container parent)
{
int components = parent.getComponentCount();
int visibleComponents = getVisibleComponents( parent );
if (components == 0) return;
// Determine space available for components using relative sizing
float relativeTotal = 0.0f;
Insets insets = pa... |
3752bf0a-566d-4976-b046-73bf69c3de0d | 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... |
6b2170dd-6756-4fdc-b8e7-c2ca8af83473 | 5 | public byte[] get(int id) {
try {
byte header[] = new byte[6];
index.seek(id * 6);
index.readFully(header);
int length = ((header[0] & 0xff) << 16) + ((header[1] & 0xff) << 8) + (header[2] & 0xff);
int position = ((header[3] & 0xff) << 16) + ((header[4] & 0xff) << 8) + ... |
33490176-02fb-4940-a21b-3ba0cb881651 | 6 | public boolean generate(World var1, Random var2, int var3, int var4, int var5) {
int var11;
for(boolean var6 = false; ((var11 = var1.getBlockId(var3, var4, var5)) == 0 || var11 == Block.leaves.blockID) && var4 > 0; --var4) {
;
}
for(int var7 = 0; var7 < 4; ++var7) {
int var8 =... |
287f5a9a-ebf9-473d-a7da-cef2b564400c | 8 | public void actionPerformed(ActionEvent ae)
{
if(ae.getSource() == jRecoverPanel.getCancelButton())
{
setVisible(false);
jLoginFrame.setVisible(true);
dispose();
}
else if (ae.getSource() == jRecoverPanel.getRecoveryButton())
{
String szEmail = jRecoverP... |
8d4225eb-116d-4800-890d-8ac06c8a01f4 | 1 | public void mousePressed(MouseEvent e){
if(SwingUtilities.isLeftMouseButton(e)){
dragging = true;
startPoint = e.getLocationOnScreen();
startBounds = e.getComponent ().getBounds();
}
} |
3d7db1f7-cfef-46a7-a6c1-568764908065 | 8 | void secondGuessUpdate(int a, int b, int a1, int b1){
if (a + b == 3) {
updateAnsSet("4567", a1, b1);
} else if (a == 0 && b == 2) {
updateAnsSet("0168", a1, b1);
} else if (a == 1 && b == 1) {
updateAnsSet("0167", a1, b1);
} ... |
c20d9239-2ac0-49c6-a22a-dbcc7f4efe84 | 0 | public int value() {
return count.get();
} |
bedd8dde-91a0-47a9-a84c-313ee1562a69 | 3 | @Override
public void setValueAt(Object value, int row, int col) {
switch (col) {
case 0:
sortedElements.get(row).setStatus((Status) value);
try {
model.saveStatusFile();
} catch (IOException e) {
JOptionPane.showMessageDialog(null,
"Error saving status file: " + e);
}
model.fireCourse... |
842691bd-2c1f-48c7-b423-b631d0a10217 | 8 | private void reload() throws IOException {
new Thread() {
@Override
public void run() {
try {
if (debug)
logger.log(Level.DEBUG, "Reloading devices...");
// Load ADB devices
deviceMap.clear();
... |
bd8ec40a-d402-480a-bd76-dfb6b4bb8904 | 6 | public static void main(String args[]) {
/* Set the Nimbus look and feel */
//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
/* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
* For details see http://down... |
b7a97b40-dd53-481f-93cd-68ba5000eeab | 1 | public Backup[] getBackups(){
String [] bdirs = new File(BACKUP_DIR).list();
Backup[] backups = new Backup[bdirs.length];
for (int i = 0;i<bdirs.length;i++){
String path = BACKUP_DIR+bdirs[i];
String name = getName(path);
String date = getDate(path);
String number = getNumber(path);
backups[i] = n... |
f634ab95-a22d-4763-93a3-b2f561335784 | 6 | private void setProperAnimation() {
if (isFalling()) {
setProperFallingAnimation();
return;
}
if (facing == 1) {
if (!getCurrentAnimation().equals(Characters.WALK_RIGHT)) {
setCurrentAnimation(Characters.WALK_RIGHT);
}
return;
}
if (facing == -1) {
if (!getCurrentAnimation().equals(Char... |
1366da53-bb4a-474d-9084-439d11d4b721 | 8 | public void draw()
{
Display.fill(
shipColour.getRed(),
shipColour.getGreen(),
shipColour.getBlue(),
shipColour.getAlpha());
if(drawLines)
{ Display.stroke(0); }
else
{ Display.noStroke(); }
if(drawDeadCells)
{
if(shipColour.getAlpha()>4)
{
shipColour = new Color(
shi... |
4cca7531-bc41-45d3-b308-89c0446913b4 | 4 | public static int compare(ItalianDeckCard card1,ItalianDeckCard card2, ItalianDeckSuit suit){
if(card1.getSuit().toString().equals(suit.toString())&&!card2.getSuit().toString().equals(suit.toString())){
//TODO The player with life takes the card
return 1;
} else if(card2.getSuit().toString().equals(suit.toStr... |
f76b72ef-db38-48a3-8afa-cf5e6f406f1e | 3 | public void createBufferedReader()
{
try {
fileReader = Files.newBufferedReader(file);
} catch (IOException | SecurityException e) {
System.err.format("IOException: %s%n", e);
try {
if (fileReader != null) { fileReader.close(); }
... |
63af4f14-f82a-4dae-b4bc-122f0adc7231 | 6 | @Override
public void deserialize(Buffer buf) {
guildOwner = buf.readString();
worldX = buf.readShort();
if (worldX < -255 || worldX > 255)
throw new RuntimeException("Forbidden value on worldX = " + worldX + ", it doesn't respect the following condition : worldX < -255 || worldX... |
deaf46c2-d8d3-4eb6-881d-b28d7ec4ba34 | 6 | public void keyPressed(KeyEvent e)
{
int keycode = e.getKeyCode();
System.out.println("key pressed: ");
switch(keycode)
{
case KeyEvent.VK_UP:
System.out.println("up");
Sounds.move.play();
ShipShopWeaponsMenu.moveSelectionOvalUp();
break;
case KeyEvent.VK_DOWN:
System.out.println("down... |
de702339-d7f7-4e09-82ef-e7925cd730cb | 3 | @Override
public boolean equals(Object obj) {
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
final ArCustomer other = (ArCustomer) obj;
if (!Objects.equals(this.szCustomerId, other.szCustomerId)) {
... |
b65b85d8-d743-4a01-83e1-4c5c34120de6 | 0 | @Override
public void rotateY(int angle) {
base = DimensionalTrasform.rotateY(angle, base);
setColoredExes();
} |
c05bf596-944a-49a9-8936-e2528758c2a6 | 8 | private static String trimLineTextWithWidth(String text, int width) {
String tText = text.trim();
if ("".equals(tText)) return "";
if (text.length() <= width) return text;
StringBuilder sb = new StringBuilder();
int currLoc = 0, nextLoc = 0;
do {
currLoc = 0;
nextLoc = tText.lastIndexOf(" ", width);
... |
ef1770b3-7590-4849-bfbe-f54f9743754e | 8 | private void init() throws NoInputException {
printInitialScenario490();
initialPurchasesOfPlayer690();
initialShootingRanking920();
screen.clear();
print("<i>** Your trip is about to begin... **</i>");
print();
for (int j = 0; j < 20; j++) {
if (m > 2039) {
madeIt3190(j);
break;
}
print(... |
ab7318d4-1f65-47f1-b63c-aaa1968ab53c | 8 | public ImagePlus apply()
{
final int width = input.getWidth();
final int height = input.getHeight();
final int depth = input.getStackSize();
//final ImagePlus imageOutput = input.duplicate();
//final ImageStack imageStackOutput = imageOutput.getStack();
final ImageStack inputStack = input.getStack();
... |
2de8078a-d0fe-4064-9860-16a5d4caf9ad | 3 | @EventHandler
public void onRightClick(PlayerInteractEvent ev) {
if (ev.getAction() == Action.RIGHT_CLICK_BLOCK) {
Player p = ev.getPlayer();
if (mahData.checkMuddles(mudz.parseLocation(ev.getClickedBlock().getLocation()))) {
if (!isInCooldown(p.getUniqueId())) {
... |
c3fda762-f6eb-49ef-a847-acee4842c6d6 | 5 | public static String getIDFromFile(String filename, String setting) {
JSONObject file = null;
try {
file = Util.readJSONFile("./" + filename);
} catch (IOException ex) {
Logger.error("IDHelper.getIDFromFile", "Failed to load external ID file!", false, ex);
r... |
3db8b5a1-7e77-4584-8f2e-c753e3fd211d | 9 | private void loadBeanDefinitionsFromImportedResources(final Map<String, Class<? extends BeanDefinitionReader>> importedResources) {
final Map<Class<?>, BeanDefinitionReader> readerInstanceCache = new HashMap<Class<?>, BeanDefinitionReader>();
for (final Map.Entry<String, Class<? extends BeanDefinitionReader>> ... |
9abe5240-52b0-4a5a-a291-6b1d457bf52f | 9 | private static boolean updateJoinCardinality(Join j, Map<String, Integer> tableAliasToId,
Map<String, TableStats> tableStats) {
DbIterator[] children = j.getChildren();
DbIterator child1 = children[0];
DbIterator child2 = children[1];
int child1Card = 1;
int child2Card = 1;
String[] tmp1... |
83d41678-208f-4075-b1e6-75a6cf41116a | 5 | @Override
public void runTask(InstallTasksQueue queue) throws IOException {
if (this.zipExtractLocation != null)
unzipFile(this.copyTaskQueue, this.cacheLocation, this.zipExtractLocation, this.filter);
if (sourceUrl != null && (!this.cacheLocation.exists() || (fileVerifier != null && !f... |
aba1c812-1d26-4b88-a89c-cbb445ede856 | 7 | public static void parse( String queryString,
String encoding,
Map<String,String> destination )
throws NullPointerException,
UnsupportedEncodingException {
if( queryString == null )
throw new NullPointerException( "Cannot parse null-query." );
String[] split = queryString.split(... |
1671b241-d811-494f-b447-025f087c3a81 | 0 | @Override
public void mouseEntered(MouseEvent e) {
} |
9f387cf9-9cc9-494f-922e-5de629e6c29c | 2 | private static GeneralNameValueConfig getConfigByField(String field,ArrayList<GeneralNameValueConfig> fieldSet) {
for(GeneralNameValueConfig cfg : fieldSet) {
if(cfg.fieldName.equalsIgnoreCase(field)) {
return cfg;
}
}
return null;
} |
ff73152f-eb46-482c-9ff8-ed2d10fdcf86 | 2 | public void test_set_RP_int_intarray_int() {
OffsetDateTimeField field = new MockOffsetDateTimeField();
int[] values = new int[] {10, 20, 30, 40};
int[] expected = new int[] {10, 20, 30, 40};
int[] result = field.set(new TimeOfDay(), 2, values, 30);
assertEquals(true, Arrays.equa... |
99183394-2d67-437d-b6b9-83f9a41fd4e5 | 4 | public boolean isNoiseWord(String string) {
// TODO Auto-generated method stub
string = string.toLowerCase().trim();
Pattern MY_PATTERN = Pattern.compile(".*[a-zA-Z]+.*");
Matcher m = MY_PATTERN.matcher(string);
// filter @xxx and URL
if (string.matches(".*www\\..*") || string.matches(".*\\.com.*")
... |
0536c66f-ba0f-4dbb-ae46-56ce2d0db8d3 | 8 | @Override
public void run() {
this.mJoinLock.lock();
try {
MusicPlayerException exception = null;
boolean failure = false;
try {
if ( this.mAlreadyStarted ) {
throw new IllegalStateException( "has alredy been started once!" );
}
this.mAlreadyStarted = true;
int bytesRead = 0;
Audi... |
7bc53e9b-eec7-48db-887d-c5d0c78a8220 | 1 | public void visit_ddiv(final Instruction inst) {
stackHeight -= 4;
if (stackHeight < minStackHeight) {
minStackHeight = stackHeight;
}
stackHeight += 2;
} |
a2ab42c2-a9e7-4212-bc2f-2752dc1aa49e | 1 | public static void main(String[] args) {
SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
try {
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
new MainFrame();
} catch (... |
1954d940-d93f-4e92-99b1-8709e0a51385 | 7 | String checkSecurity(int iLevel, javax.servlet.http.HttpSession session, javax.servlet.http.HttpServletResponse response, javax.servlet.http.HttpServletRequest request){
try {
Object o1 = session.getAttribute("UserID");
Object o2 = session.getAttribute("UserRights");
boolean bRedirect = false;
... |
c26c10b0-d7b3-4493-83c7-fe962c10e168 | 6 | public String formatResultAccordingToWeatherLocation(String output, boolean weather, String ownloaction) {
String weatherReportOrLocation=null;
if(weather==false && ownloaction==null){
weatherReportOrLocation=output.substring(0, output.indexOf("maps.google.co.in"));
System.out.println("Location:"+weatherReportO... |
a72c4762-62ae-48d4-843d-0befb4bb3e7b | 7 | public static boolean isParityAdjusted(
byte[] key,
int offset)
throws InvalidKeyException
{
if ((key.length - offset) < DES_KEY_LEN)
{
throw new InvalidKeyException("key material too short in DESKeySpec.isParityAdjusted");
}
for (int i = 0; i < DES_KEY_LEN; i+... |
a9b809a2-1519-4ac5-a884-5dc3d1db997b | 7 | @Override
public void unInvoke()
{
if(canBeUninvoked())
{
if((affected!=null)&&(affected instanceof MOB)&&(!aborted)&&(!helping))
{
final MOB mob=(MOB)affected;
if(failed)
commonTell(mob,L("You failed to get the fire started."));
else
{
if(lighting==null)
{
final Item I=... |
4b870fa2-b48e-48dd-994d-4aeb7fe05643 | 6 | int stripeForObject(Object o) {
if (o == null)
return 0;
Integer sh = null;
if (shiftsForClasses != null) {
Class<?> cl = o.getClass();
while (cl != Object.class && (sh = shiftsForClasses.get(cl)) == null)
cl = cl.getSuperclass();
}
... |
4690e765-e21f-4cfa-a222-3a56d6c4e6e7 | 7 | public static String extractTrackFrom(String filePath)
/*
* The extractTrackFrom method checks the ID3 version of the mp3 file and
* extracts the track number from the MP3 file.
*/
{
String track = null;
try
{
Mp3File mp3File = new Mp3File(filePath);
if (mp3File.hasId3v2Tag())
{
ID3v2 id... |
0c39eb7a-450c-42bc-a19e-137225b7b78d | 8 | public double getKokRegula() {
double a1 = getBas();
double b1 = getSon();
double fa = 0;
double fb = 0;
double fc = 0;
do {
fa = 0;
fb = 0;
fc = 0;
for (int i = 0; i < katsayilar.length; i++) {
fa += (ka... |
f9f6f733-7f6a-483a-b121-239959318937 | 6 | private void btnenvoyerActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnenvoyerActionPerformed
OffreStage o1 = new OffreStage (MainProjet.lesEntreprises.get(jComboNomE.getSelectedIndex()),
jTextLibellé.getText() ,
jComboDomaine.getSelectedItem().t... |
93df9a03-5eac-4f64-8ed6-872dfb6d38a0 | 7 | public double weightedStandardDeviation_of_ComplexModuli() {
boolean hold = Stat.nFactorOptionS;
if (nFactorReset) {
if (nFactorOptionI) {
Stat.nFactorOptionS = true;
} else {
Stat.nFactorOptionS = false;
}
}
boolean hold2 = Stat.nEffOptionS;
if (nEffReset) {
if (nEffOptionI) {
Stat.nE... |
46f44ab0-9124-4fd5-bad6-9a8c6039d3e9 | 4 | public void updateTotalWeekHours(){
int totalHours = 0;
int totalMinutes = 0;
for(int x = 1; x < tableColumns; x++)
{
if(tableData[tableRows-1][x]!=null)
{
totalHours += timeToCode(tableData[tableRows-1][x])/100;
totalMinutes += timeToCode(tableData[tableRows-1][x])%100;
}
}
... |
e069e5b0-4d46-4d06-8251-f85f0356c015 | 7 | private void runUpdater() {
if (this.url != null && (this.read() && this.versionCheck())) {
// Obtain the results of the project's file feed
if ((this.versionLink != null) && (this.type != UpdateType.NO_DOWNLOAD)) {
String name = this.file.getName();
// If... |
57375e8a-7a4d-4df3-9969-8e8003f4c278 | 7 | public static Vector<String> printEventDist(EventDistance e_dis, Event cur_e){
Vector<String> changes=new Vector<String>(0);
if(printLoc(e_dis.x_dis, e_dis.z_dis, cur_e.x, cur_e.z)==null){
}
else{
String loc_str=""+printLoc(e_dis.x_dis, e_dis.z_dis, cur_e.x, cur_e.z)... |
0c8472d0-3439-47fb-9a44-2545507f89de | 8 | public void map(Text key, Text value, Context context) throws IOException,
InterruptedException {
try {
if (!value.toString().contains("PRIVMSG #")) {
return;
}
RecentChange rc = RecentChange.parse(key.toString()+"\t"+value.toString());
//Don't incude anonymous edits, bots, minor edits, edits ... |
3727f178-24ba-4b28-9757-4db75abd03f9 | 1 | @Override
protected void paintChildren(Graphics gc) {
super.paintChildren(gc);
if (mDragOverNode != null) {
Rectangle bounds = getDragOverBounds();
gc.setColor(DockColors.DROP_AREA);
gc.fillRect(bounds.x, bounds.y, bounds.width, bounds.height);
gc.setColor(DockColors.DROP_AREA_INNER_BORDER);
gc.draw... |
db4f3723-e740-43ef-b769-7093a47a96bb | 6 | private void test4thLevel() {
for (Map.Entry<String, HashMap<String, HashMap<String, HashMap<String, SentiWord>>>> map2 : this.sentimentMap.sentiMap.entrySet()) {
String word1 = map2.getKey();
for (Map.Entry<String, HashMap<String, HashMap<String, SentiWord>>> map3 : map2.getValue().entr... |
883cbb5d-851f-446d-a771-5b4fbc6d4e23 | 2 | SerializedProxy(Class proxy, MethodFilter f, MethodHandler h) {
filter = f;
handler = h;
superClass = proxy.getSuperclass().getName();
Class[] infs = proxy.getInterfaces();
int n = infs.length;
interfaces = new String[n - 1];
String setterInf = ProxyObject.class.g... |
798781d1-be4c-40c8-8f47-bdaa446a9a76 | 8 | public void recoverTree(TreeNode root) {
if (root == null)
return;
ArrayList<Bundle> arr = inOrderTraversal(root);
if (arr.size() < 2)
return;
Bundle first = null, second = null;
for (int i = 0; i < arr.size() - 1; i++) {
if (... |
3abf41ed-732d-4a8e-a911-b1b9340d0593 | 5 | private byte[] getContents(PDFObject pageObj) throws IOException {
// concatenate all the streams
PDFObject contentsObj = pageObj.getDictRef("Contents");
if (contentsObj == null) {
throw new IOException("No page contents!");
}
PDFObject contents[] = contentsObj.getAr... |
945733de-e3a9-4e64-bae4-726dcd7567f2 | 0 | public String getComponentTitle() {
return "Multiple Run";
} |
0114c2a8-04dd-43bc-8fd5-71d1ae7af643 | 5 | private void setStats(long start) {
if(this.stats != null) {
DateFormat dateFormat = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss");
Calendar cal = Calendar.getInstance();
String duration = "";
if(start != 0) {
duration = " [" + (cal.getTimeInMillis() - start) + "ms]";
}
String validation ... |
05bb7cfc-d6df-497b-bca2-6ddebb309505 | 6 | public boolean findString(String words) {
if (root==null) return false;
for (StringNode temp = root;!temp.value.equals(words);) { //increment statement in loop
if (words.compareTo(temp.value)<0) {//go left if words < temp
if (temp.left==null) return false;//can't go left, you... |
f1dddc94-0a39-4604-944c-40ebaf88ba5c | 9 | @Override
public void render(GameContainer arg0, StateBasedGame arg1, Graphics arg2)
throws SlickException {
if (ended) {
arg2.drawImage(winOrLose, 250, 200);
}
if (initDone && constructDone) {
Player play = players[mIndex];
if (play != null) {
float px = play.getPos().x;
float py = play.getP... |
73cac037-8973-44be-b7ba-c92edb698a5a | 2 | public void reset() {
for (int i = 0; i < tx; i++) {
for (int j = 0; j < ty; j++) {
this.brd[i][j] = Counter.EMPTY;
}
}
} |
7d39a3d9-5dac-472b-a82a-58c0da9c8817 | 0 | public OrderQuest() {
super(QuestType.ORDERQUEST);
goTo="";
} |
d7416bda-bc52-4561-b322-d4547784a5fb | 0 | public void setProducto(Producto producto) {
this.producto = producto;
} |
17f70600-dfab-4904-9b6a-60f597d0dc21 | 2 | public static VisitBankAndDepositGold getSingleton(){
// needed because once there is singleton available no need to acquire
// monitor again & again as it is costly
if(singleton==null) {
synchronized(VisitBankAndDepositGold.class){
// this is needed if two threads are waiting at th... |
c599567a-5187-4ec6-ab28-93d9ead99a94 | 5 | public void testSyntaxSet1() {
if (syntax.equals("traditional")) {
try {
JPL.setTraditional(); // should succeed silently
} catch (Exception e) {
fail("setTraditional() under traditional syntax threw exception: " + e);
}
} else {
try {
JPL.setTraditional();
} catch (JPLException e) { // e... |
ac1ef220-4f09-421f-97e1-fa67651b51be | 6 | boolean isAgent(int memberType) {
if (memberType == GameController.passiveUser || memberType == GameController.userContributor || memberType == GameController.userBugReporter ||
memberType == GameController.userTester || memberType == GameController.userCommitter || memberType == GameController.userLeader)
{... |
d6086763-05e8-471c-9d5a-2f9944929672 | 8 | public void fileDialogAction (MyFileDialog f, int action) {
if (action == MyFileDialog.OKAY) {
if (f.getMode() == MyFileDialog.LOAD) {
WindowRegistry.saveCursors();
WindowRegistry.setAllCursors (WAIT_CURSOR);
try {
if (f.isURL())
new SynthWindow (f.getURL()).show();
e... |
a614c722-6765-4ded-9783-7a196b45ec29 | 0 | public Connection getConnection() {
return connection;
} |
f9df8c86-9a85-471e-bb4a-a516ca1fc6e8 | 5 | public static Relation valueOf(int s) throws ParseException
{
switch(s) {
case 0: return UNCONFIRMED;
case 1: return BUDDY;
case 2: return DECLINED;
case 3: return STRANGER;
case 4: return BANNED;
default: throw new ParseException("Invalid relation value:"+s+", expected 0,1,2... |
61a42afb-e7d9-4f3d-b9a2-5e7c9d726dbe | 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... |
8238e2e2-98a0-4ef8-92fb-5df5cd2c01f8 | 9 | @Override
public boolean invoke(MOB mob, List<String> commands, Physical givenTarget, boolean auto, int asLevel)
{
if(mob.location().getArea().getTimeObj().getTODCode()!=TimeClock.TimeOfDay.NIGHT)
{
mob.tell(L("This chant can only be done at night."));
return false;
}
if(!mob.location().getArea().get... |
df7fcac0-fce0-441c-893c-452ac02b37f4 | 9 | private Runnable rawplay(final AudioFormat targetFormat, final AudioInputStream din) {
Runnable blah = new Runnable(){
public void run() {
SourceDataLine line = null;
try {
byte[] data = new byte[4096];
try {
line = getLine(targetFormat);
} catch (LineUnavailableException... |
f785db68-61b1-4244-900d-9e4cf5860614 | 3 | @Override
protected void read(InputBuffer b) throws IOException, ParsingException {
int first = b.get(0) & 0xFF;
byte[] varInt;
if (first < 0xfd) {
varInt = new byte[] { (byte) first };
} else {
varInt = b.get(1, 1 << first - 0xfc);
}
// Add a zero prefix to get a length of 8.
byte[] tmp = new by... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.