method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
ebcec2aa-62ab-4a13-a07d-b84b104387c3 | 7 | public boolean removeSign(Location signLoc){
for(int i=1;signConfig.get("signs." + i)!=null;i++){
if(signConfig.get("signs." + i + ".liftID")!=null){
if(signLoc.getWorld().getName().equals(signConfig.getString("signs." + i + ".location.world"))){
if(signLoc.getBlockX()==signConfig.getInt("signs." + i... |
da7869c3-a6b4-4b9c-823d-c078f4720146 | 0 | public synchronized void start() {
running = true;
mainThread = new Thread(this, "Main Thread");
mainThread.start();
} |
9b4f7ba9-61ee-43a4-ae43-0144e6196c54 | 1 | public void visit_ifnonnull(final Instruction inst) {
stackHeight -= 1;
if (stackHeight < minStackHeight) {
minStackHeight = stackHeight;
}
} |
4b66eefa-3545-41ec-a2d9-59644d8049fd | 2 | public Integer[][] convert(int[][] intGrid) {
Integer[][] grid = new Integer[9][9];
for (int i = 0; i < 9; i++) {
for (int t = 0; t < 9; t++) {
grid[i][t] = intGrid[t][i];
}
}
return grid;
} |
d94c5fb1-cae0-4815-aa56-2e1327ee1228 | 5 | private static String createInferenceCommandInternal(CycObject query, ELMt mt,
InferenceParameters queryProperties, Map nlGenerationProperties,
CycSymbol answerProcessingFunction, boolean optimizeVariables, CycAccess cycAccess) {
if (queryProperties == null) {
queryProperties = new Default... |
b0c65ed0-f6f2-468d-b53c-4e2f3f7ce7ba | 1 | public AppletContext getAppletContext() {
if (Signlink.mainapp != null) {
return Signlink.mainapp.getAppletContext();
} else {
return super.getAppletContext();
}
} |
083dd1cb-2175-4ee1-a718-423a09d78109 | 2 | @Override
public void updateAll() {
if (allNews.size() > 0) {
for (Observer observer : readers) {
observer.update(allNews.get(allNews.size() - 1));
}
}
} |
601431e2-cfba-4586-a243-947347467e9c | 8 | public String getGrepCommand(ClientArgs clientArgs, String logFileName)
{
String keyRegExp = clientArgs.getKeyRegExp();
String valRegExp = clientArgs.getValRegExp();
String options = clientArgs.getOptionsString();
String command = "";
// Handle corner cases of "$" apperaring at the end of keyRegExp and "^... |
af0fdbc7-d5d0-4941-bb71-7c2e3631c170 | 0 | public LoadingDialog()
{
super();
setUndecorated(true);
setModal(true);
JPanel mainPanel = new JPanel();
mainPanel.setPreferredSize(new Dimension(300, 250));
mainPanel.setBorder(DefaultUIProvider.getDefaultEmptyEtchedBorder());
BoxLayout boxLayout = new Box... |
27bba58a-aa90-45cc-97c6-3420ea5b6b93 | 9 | public int[] findOrder(int numCourses, int[][] prerequisites) {
if (numCourses <= 0) {
return new int[] {};
}
int[] result = new int[numCourses];
int index = 0;
Map<Integer, List<Integer>> graph = new HashMap<Integer, List<Integer>>();
Map<Integer, Integer> in = new HashMap<Integer, Integer>();
for (in... |
4a7c38c1-23f3-488d-81f6-cdb46a9a84e4 | 9 | private static double[] toLab(final int red, final int green, final int blue)
{
//The weight of chromaticity [0–∞[, 1 is unweighted.
final double chromaWeight = 1;
int ir = red ; if (ir < 0) ir += 1 << 8;
int ig = green; if (ig < 0) ig += 1 << 8;
int ib = blue ; if (ib < 0) ib += 1 << 8;
dou... |
0175ea4e-70ce-480a-bdc7-11b9ef0c0e43 | 4 | @Override
public void removeClient(Integer id) {
if(clientsList.containsKey(id))
{
clientsList.remove(id);
if(clientsNames.containsKey(id)) {
clientsNames.remove(id);
}
}
for(Integer key: getClientSet()) {
if(key != id) {
getClientInstance(key).sendNewUserList();
}
}
sendMes... |
8c425e8b-0fd0-456a-9a99-3118ce5d86a9 | 2 | public static void handleGetTicketReply(HTSMsg msg, HTSPClient client) {
Collection<String> requiredFields = Arrays.asList(new String[]{"path","ticket"});
if (msg.keySet().containsAll(requiredFields)){
//TODO
} else if (msg.get("error") != null){
//TODO
} else{
System.out.println("Faulty reply");
}
... |
fc287cb4-5daa-4f11-a632-6859e811d6c0 | 6 | public static String executePost(String targetURL, String data, String contentType) {
URL url;
HttpURLConnection connection = null;
try {
//Create connection
url = new URL(targetURL);
connection = (HttpURLConnection) url.openConnection();
connection.setRequestMethod("POST");
if (data != null) {
... |
55c7d8d8-490c-4ac4-b46b-3e3e302ef3e7 | 4 | public boolean contains(Permission perms, Player player) {
if (groups != null && !groups.isEmpty()) {
for (GroupAssignment group : groups) {
if (!perms.playerInGroup(group.getWorld(), player.getName(), group.getGroup())) {
return false;
}
... |
2f6d93ba-f2c2-4b63-b62c-92995a6fbd62 | 9 | @Override
public void executeMsg(final Environmental myHost, final CMMsg msg)
{
super.executeMsg(myHost,msg);
// the sex rules
if(!(myHost instanceof MOB))
return;
final MOB myChar=(MOB)myHost;
if((msg.amITarget(myChar))
&&(CMLib.dice().rollPercentage()<10)
&&(msg.tool() instanceof Social)
&&(msg.... |
819c7551-7774-459f-a721-7a0334714679 | 0 | public Cycle(Peg x, Peg y, Peg z, int type) {
this.x = x;
this.y = y;
this.z = z;
this.type = type;
movePegs();
} |
cdc0af16-b169-4dc2-a122-b6effeadb27e | 0 | public void setCondition(String condition) {
this.condition = condition;
} |
efd9d3cc-148b-4879-b66e-e4c07078c00e | 7 | @Override
public boolean onCommand(CommandSender sender, Command command, String label,
String[] args)
{
if (!(sender instanceof Player))
{
sender.sendMessage("Only players can open a shared chest.");
return true;
}
Player p = (Player) sender;
if (args.length != 1)
return false;
String name ... |
8ad7184c-18e9-40bb-aed7-ec6b825ca9e6 | 8 | public void handleInputUpload(DFSClientRequest req){
//Create a DFSInput File
DFSInputFile dif = new DFSInputFile(req.getFileName());
dif.setNumOfRecords(req.getFileLineNum());
nn.JobStatusMap.put(req.getJobName(), new DFSJobStatus(dif));
//Chop the DFSInput File off by the number of DataNodes
int sum... |
80030018-63fb-4abd-bc2e-36611d181484 | 6 | public void mouseClicked(java.awt.event.MouseEvent me)
{
// System.out.println("\n mouseClicked");
TWPoint p = drawBoard_.mapClickToRowAndCol(new TWPoint(me.getPoint()));
// System.out.println("mouse click @ " + p.x + "/" + p.y);
if (currentState_ == STATE_PLACE_PEG)
{
tryPlacePeg(p);
}
else if (currentSt... |
4920a134-7c68-4591-9833-e8a8bc88a191 | 6 | @Override
public void computeData() {
for (Building b : _player.getBuildings()) {
switch (b.getType()) {
case "water_turbine":
_buildings[WATER] += computeProduction(BuildingInfo.WATER);
break;
case "wind_turbine":
... |
f40c5930-9f13-48d8-80a2-ce769e2e0641 | 3 | public Material getMaterial() {
Material material = null;
if (id != null) {
material = Material.getMaterial(id);
}
if (material == null && name != null) {
material = Material.getMaterial(name);
}
return material;
} |
dc4c8ef2-9e54-4ecc-bfb4-43479bdbc20e | 0 | public void itemReceived(Auction auction, String time){ auction.itemReceived(time); } |
9a5b024f-f687-428a-b456-1d195fa28341 | 8 | protected void changeButtonBorder(AbstractButton b) {
Object cp = b.getClientProperty("paintToolBarBorder");
if ((cp != null) && (cp instanceof Boolean)) {
Boolean changeBorder = (Boolean)cp;
if (!changeBorder.booleanValue()) {
return;
}
}
... |
d78b680d-d312-4f66-aff3-daed4cd6e436 | 7 | public void init() {
String fileNameValidTransitionTable = null;
try {
fileNameValidTransitionTable = Util.getStringProperty("FileNameValidTransitionTable");
} catch (IOException e) {
e.printStackTrace();
}
try {
transitions = createValidTrans... |
c94d9a3b-922c-4e01-af20-faf66ac019a5 | 2 | public String next() {
if (cmds.size() == 0) {
return null;
}
if (cursor < cmds.size() - 1) {
cursor++;
}
return cmds.get(cursor);
} |
ccbf8e60-1ce8-4e22-8e2e-117c66f82ba8 | 4 | private boolean jj_3R_15()
{
if (jj_scan_token(FUN)) return true;
if (jj_3R_17()) return true;
if (jj_scan_token(ARROW)) return true;
if (jj_3R_11()) return true;
return false;
} |
790e7398-1c04-406c-9002-a9139c6e0553 | 7 | public void pick(Deck deck) {
PickResult pair = PickResult.pair;
Card cards[] = new Card[2];
// the bot will continue to pick cards while it knows a pair,
// this could be unfair, the bot should "think" (wait) before
// picking more cards, currently it will gain lots of bonus points.
while (pair == PickRes... |
5d15a770-2f7b-443d-8789-cb2260cc0108 | 3 | public char skipTo(char to) throws JSONException {
char c;
try {
long startIndex = this.index;
long startCharacter = this.character;
long startLine = this.line;
this.reader.mark(1000000);
do {
c = this.next();
if... |
2406dc7e-2e80-49ce-8bf2-531ee9a645a9 | 6 | public boolean isInBound( AABB aabb )
{
if ( x > aabb.getMax().getX() || x < aabb.getMin().getX() )
return false;
if ( y > aabb.getMax().getY() || y < aabb.getMin().getY() )
return false;
if ( z > aabb.getMax().getZ() || z < aabb.getMin().getZ() )
return false;
return true;
} |
43397d96-50e9-4e11-a02a-9087fb683714 | 6 | public final void method482(int j, int k, int l, int i1, int j1, int k1) {
int i = 0;
int l1 = Texture.textureInt1;
int i2 = Texture.textureInt2;
int j2 = modelIntArray1[i];
int k2 = modelIntArray2[i];
int l2 = modelIntArray1[j];
int i3 = modelIntArray2[j];
int j3 = modelIntArray1[k];
int k3 = modelIn... |
70c16e77-6b9a-444d-8c7b-7001b873c8a8 | 5 | public void cull() {
if (!active(GET, XXX))
return;
if (playing() && toLoop)
toPlay = true;
if (rawDataStream)
toPlay = true;
active(SET, false);
if (channel != null)
channel.close();
channel = null;
} |
e48f8be3-d182-4c66-a9b2-02a304dc2181 | 4 | private String[] findGroups(String user) {
Connection connection = null;
PreparedStatement statement = null;
ResultSet rs = null;
try {
connection = getConnection();
statement = connection.prepareStatement(groupQuery);
int paramCount = gro... |
1f74151e-0db4-434f-9ff1-b3a407360c2e | 6 | @Override
public void mousePressed(MouseEvent e) {
if(e.getSource()==recordBut){
recordBut.setIcon(recordClickIcon);
}else if(e.getSource()==playBut){
playBut.setIcon(playClickIcon);
}else if(e.getSource()==stopBut){
stopBut.setIcon(stopClickIcon);
}else if(e.getSource()==saveBut){
saveBut.setIcon(... |
52bc5380-ad84-4748-9103-7099669a5ee0 | 3 | public String ingresarLetra(String letra) {
if(aciertos != tamanioPalabra){
if (intentos > 0){
if (verificarLetra(letra)){
return "letra correcta";
}
else{
puntuacion-=10;
intentos--;
return "Error, letra incorrecta";
}
}
else{
return "PERDIO!!!";
}
}
else{
b... |
fd3938ed-c726-4f8a-bda0-2f4dd5eda795 | 6 | public int getBurnTimeByStack(ItemStack i)
{
if(i == null || i.item == null)
return -1;
if(i.item.id.equals(Block.planks.getItem().id))
{
return 600;
}
else if(i.item.id.equals(Block.log.getItem().id))
{
return 800;
}
else if(i.item.id.equals(Item.coal.id))
{
return 1800;
}
e... |
70550118-36f2-4af0-9748-1d71cb7eafd3 | 5 | private static void giveKit(final String nick, final String kit)
{
if(!Conf.config.getProperty("enable-kits", "true").equals("true")) {
Cmd.sayToPlayer(nick, "kits are disabled.");
return;
}
final String[] items = Conf.kits.getProperty(kit).split(" ");
if(items.length%2 != 0)
return;
for(int i=0; i<items.l... |
958ec0c9-bd38-4c05-905b-f7bc18c255c6 | 0 | public LoggerAppender() {
} |
723e495c-08c8-429d-acfa-a755df437125 | 0 | public boolean isAdd() {
return myAdd;
} |
815825ec-5341-492e-a5a3-238c21d24d5e | 0 | public long getTotalSize()
{
return totalSize;
} |
07fab30e-b337-4f10-9086-94dd4100b880 | 1 | public void visitDefExpr(final DefExpr expr) {
if (expr instanceof MemExpr) {
visitMemExpr((MemExpr) expr);
}
} |
b2e0c6d4-f740-4f73-9114-e2a918c57b44 | 5 | public void edit(Tenant tenant) throws NonexistentEntityException, Exception {
EntityManager em = null;
try {
em = getEntityManager();
em.getTransaction().begin();
tenant = em.merge(tenant);
em.getTransaction().commit();
} catch (Exception ex) {
... |
9c719da5-4cc8-4fef-b05d-12540a0bcc05 | 2 | private void jBtnInsertActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jBtnInsertActionPerformed
// TODO add your handling code here:
try {
String flag = (String) jComboBox1.getSelectedItem();
if (!"<Seleccione>".equals(flag)) {
String sql = "IN... |
f0fadb79-9b6a-4842-84f7-c9a83e65a247 | 5 | @Override
public void execute(CommandSender sender, String worldName, List<String> args) {
this.sender = sender;
if (worldName == null) {
error("No world given.");
reply("Usage: /gworld allowweatherchange <worldname> <true|false>");
} else if (!hasWorld(worldName)) {
reply("World not found: " + world... |
eda9f675-0e36-4969-9456-879b6992f0b0 | 2 | boolean isValidFile(File file) {
if (!file.exists()) {
System.err.println("Directory doesn't exist: " + file.getAbsolutePath());
return false;
} else if (!file.isFile()) {
System.err.println(file.getAbsolutePath() + " is not a file");
return false;
... |
2094c56f-aa37-4561-a97d-0ca397e42a70 | 5 | public static String[] sort(String[] keys, int R, int W)
{
int len = keys.length;
String[] aux = new String[len];
for(int j = W-1; j >=0; j--)
{
int[] count = new int[R + 1];
// counting Frequency
for(int i = 0; i < len; i++)
{
int index = Character.getNumericValue((keys[i].charAt(j))... |
11151ebf-0389-4673-b619-57616231b995 | 6 | public void run() {
ServerSocket serversocket = null;
Socket s;
InputStreamReader input;
BufferedReader b;
PrintWriter p;
String message = null;
boolean done = false;
try {
serversocket = new ServerSocket(Utils.FAULTMNGR_PORT, 1); /* backlog is 1 */
serversocket.setSoTimeout(0);
} catch ... |
4f7c25d1-490e-4f19-8a48-b0a784f72a8e | 5 | static public String textRead(String a_file_name)
throws FileNotFoundException, IOException
{
// for holding the string read from the file
StringBuffer contents = new StringBuffer();
// for holding the reader; to make visible to finally clause
BufferedReader input_reader = null;
try
{
... |
1cd3129e-6071-4ea9-bcc3-1f702c6ce421 | 7 | public Instance convertInstance(Instance instance) throws Exception {
if (m_s == null) {
throw new Exception("convertInstance: Latent Semantic Analysis not " +
"performed yet.");
}
// array to hold new attribute values
double [] newValues = new double[m_outputNumAtt... |
dfdd7b6f-d5e2-436f-b926-6656f2549313 | 3 | public static String getFileName(String name, String dir) {
String fileName = name;
if(exists(name, dir)) {
for(int i = 1; i < 100000; i++) {
String constructed = name + "("+i+")";
if(!exists(constructed, dir)) {
fileName = constructed;
break;
}
}
}
return fileName;
} |
ec168401-baf9-4c3d-b648-4c49d1e0bfa6 | 3 | public void save(SpoutPlayer player, AccessoryType type) {
File saveFile = new File(getDataFolder(), "saved.yml");
if (!saveFile.exists()) {
try {
saveFile.createNewFile();
} catch (IOException ex) {
Logger.getLogger(PlayerPlus.class.getName()).log(Level.SEVERE, null, ex);
}
}
YamlConfiguratio... |
f83bd856-b1a5-4628-9bb6-c56dff0476fc | 7 | public ClientConfig(byte[] configbuffer) {
this.configText = new String(configbuffer);
// I'm going in dry
// System.out.println(configText);
// ^that is printed below, i use that text to match my shit on (i don't
// wanne load per line cus its multiline data)
Matcher m1 = codeBaseRex.matcher(configText);
... |
9be06d34-b237-4448-838b-beae2a701673 | 0 | @Override
public Car driverCar() {
return new BenzCar();
} |
edc1fadd-fa87-48f4-84c8-8d8cc3038af3 | 3 | @Override
public Storeable deserialize(Table table, String value) throws ParseException {
JsonArray json = ((new JsonParser().parse(value))).getAsJsonArray();
List<Object> values = new ArrayList<>();
for (int i = 0; i < json.size(); ++i) {
values.add(json.get(i));
}
... |
071f7b78-c75c-4a03-aa24-2ac8ee3f0f06 | 4 | public final JSONObject toJSONObject(JSONArray names) throws JSONException {
if (names == null || names.length() == 0 || length() == 0) {
return null;
}
JSONObject jo = new JSONObject();
for (int i = 0; i < names.length(); i += 1) {
jo.put(names.getString(i), this... |
a6ab6b3c-aeb8-443c-b57a-7b3f16c23981 | 9 | @Override
public void or(NIOFilter filter) {
if(filter == null
|| !(filter instanceof NIOFilter)
|| filter.vectorSize != this.vectorSize
|| filter.nbHash != this.nbHash) {
throw new IllegalArgumentException("filters cannot be or-ed");
}
AdjustedCountingBloomFilter cb... |
a03bc91f-b2bd-4a4c-b3c4-882069cef896 | 3 | public void paintRubberband(Graphics g)
{
if (first != null && bounds != null
&& graphComponent.isSignificant(bounds.width, bounds.height))
{
Rectangle rect = new Rectangle(bounds);
g.setColor(fillColor);
mxUtils.fillClippedRect(g, rect.x, rect.y, rect.width, rect.height);
g.setColor(borderColor);
... |
450999ad-e158-413f-8967-6b22a0c583a3 | 4 | public static int posteX(int travee,int orientation){
int centreX = centrePositionX(travee) ;
switch(orientation){
case Orientation.NORD :
centreX -= 25 ;
break ;
case Orientation.EST :
break ;
case Orientation.SUD :
centreX -= 25 ;
break ;
case Orientation.OUEST :
centreX -= 20 ... |
8596d1a7-cb2b-46a2-9a97-efb7875f1064 | 8 | public static void main(String[] args) {
Connection conn = null;
PreparedStatement ps = null;
ResultSet reSet = null;
MyPool pool = new MyPool();
try{
conn = pool.getConnection();
ps = conn.prepareStatement("SELECT * from users");
reSet = ps.executeQuery();
while (reSet.next()) {
Str... |
e33e1cdb-68fb-419a-bdfe-02ff01be76b1 | 8 | public void update(Game game)
{
if(start == -1)
start = game.getGameTick();
float rollDie = game.getRandomGenerator().nextFloat();
if(((start+game.getGameTick()) % cooldown == 0) && rollDie < prob)
{
VGDLSprite newSprite = game.addSprite(itype, this.getPositi... |
a68bed89-6912-40f7-b5fb-dba166521572 | 5 | public void paintComponent(final Graphics g)
{
System.out.println("modelComponent.paintComponent()");
/*заполнение слева-направо по строкам*/
model.apply(new Model.ApplyToCell() {
@Override
public void apply(char cell, char box, int i, int j) {
Dimensi... |
36d842bc-ece2-4ce6-a749-6c4e5dbda1f9 | 5 | private void internalFind() {
LinkedList<LeveledPoint> curPath = new LinkedList<>();
Stack<LeveledPoint> stack = new Stack<LeveledPoint>();
stack.push(new LeveledPoint(0, 0, 0));
while(!stack.isEmpty()){
LeveledPoint curPoint = stack.pop();
curPath.subList(0, curPoint.LEVEL);
log("level: " + curPoint.L... |
bf92f849-988a-4f57-8737-a2453bf6f7a9 | 3 | @Override
protected void sort(T[] array, int leftIndex, int rightIndex) {
for (int j = leftIndex; j <= rightIndex; j++) {
T aux = array[j];
int i = j - 1;
while (i >= leftIndex && array[i].compareTo(aux) > 0) {
array[i + 1] = array[i];
i--;
}
array[i + 1] = aux;
}
} |
c6b86b9c-2faa-4570-a439-818a36e088a8 | 8 | private static int convertCharToIndex (char c) {
int col;
switch(c) {
case 'A':
col=0;
break;
case 'B':
col=1;
break;
case 'C':
col=2;
break;
case 'D':
col=3;
break;
case 'E':
col=4;
break;
case 'F':
col=5;
break;
case 'G':
col=6;
break;
case 'H':
... |
61e907af-1c27-48d7-94ea-7ecfbb918297 | 9 | public static void main(String[] args) {
try {
List jarsList = new ArrayList();
URL url = JarDeploy.class.getResource("");
JarFile bundleJar = ((JarURLConnection) url.openConnection()).getJarFile();
Manifest manifest = bundleJar.getManifest();
Attr... |
37b49330-b60b-433b-a4d4-a24bb6cb9a01 | 3 | public void run()
{
try
{
while(true)
{
synchronized(this)
{
while(availableConnections.size() > initialConnectionCount)
{
Connection c = (Connection)... |
a23ba807-3b80-4e0b-ac08-1ba268fc3b88 | 3 | void destroyPlayerMenus(Player player) {
ArrayList<Menu> destruction = new ArrayList<Menu>();
for(Menu menu : activeMenus)
if(menu.getPlayer().equals(player))
destruction.add(menu);
for(Menu menu : destruction) menu.markDestruction();
} |
e423bc62-76bf-43d9-8f3a-c91ed9675a67 | 7 | public void pushCookie() throws IOException, JSONException, IllegalBlockSizeException, IllegalBlockSizeException, IllegalBlockSizeException, BadPaddingException, BadPaddingException, BadPaddingException, NoSuchAlgorithmException, NoSuchAlgorithmException, InvalidKeySpecException, InvalidKeyException, NoSuchPaddingExcep... |
6463ac5e-20be-4690-bdf9-ec7c1608ee2c | 4 | @Override
public void update(String msg) {
char ch = msg.charAt(0);
int i = Integer.valueOf(String.valueOf(ch));
switch (i) {
case 1:
System.out.println(getClass().getName() + "说:天籁啊,真是!");
break;
case 2:
System.out.prin... |
4267db62-ea13-4996-8770-ffa55da6db67 | 1 | public void testWithFieldAdded5() {
YearMonthDay test = new YearMonthDay(2004, 6, 9);
try {
test.withFieldAdded(DurationFieldType.hours(), 6);
fail();
} catch (IllegalArgumentException ex) {}
} |
3b4244ae-6cb6-429c-b4ec-82f8e43cc6d6 | 0 | public String showDetails(){
problem = problemDAO.findById(id);
return SUCCESS;
} |
f4ecbf06-1ed6-453c-aa71-572a831488d3 | 6 | public static int dehexchar(char c) {
if (c >= '0' && c <= '9') {
return c - '0';
}
if (c >= 'A' && c <= 'F') {
return c - ('A' - 10);
}
if (c >= 'a' && c <= 'f') {
return c - ('a' - 10);
}
return -1;
} |
0cff8f1f-d60b-4c20-bf60-7b9dfc6e8ebd | 2 | private String buildUrl(String artistName,String songName){
if(artistName==null) artistName="";
if(songName==null) songName="";
StringBuilder urlBuilder = new StringBuilder();
urlBuilder.append(WIKIA_API_URL).append("api.php?func=");
urlBuilder.append("getSong&artist=").append(artistName);
urlBuilder.... |
6488f055-ac37-4eba-ba3d-8f784c038087 | 1 | public void playVictoryMusic()
{
try
{
AudioInputStream audio = AudioSystem.getAudioInputStream(new File("src/karel/sounds/victory.wav"));
Clip clip = AudioSystem.getClip();
clip.open(audio);
clip.start();
... |
cc0bf196-d446-4edc-8468-4267baafd282 | 2 | public void open() throws SQLException {
if ((this.connect == null) || (this.connect.isClosed())) {
this.connect = DriverManager.getConnection(URL, USER, PASSWORD);
}
} |
f011c876-3c48-4b4c-b198-2ca1f97b8a0e | 2 | private void processConnection() throws IOException
{
// enable enterField so client user can send messages
// setTextFieldEditable( true );
do // process messages sent from server
{
try // read message and display it
{
message = ( String ) input.readObject(); /... |
3256c8fa-ac86-4ea8-b23a-165c1a68e995 | 9 | public static void main(String[] args) {
// Get and handle Command line arguments
if (args.length > 0) {
for (int i = 0; i < args.length; i++) {
if (args[i].equals("debug")) debug = true;
}
}
// Create main GUI
new GUI();
GUI.Append("Starting server on port: " + serverPort);
// Handle files
... |
75f6706c-833d-4b79-87a7-d19afb55d35d | 7 | public static void testValidity(Object o) throws JSONException {
if (o != null) {
if (o instanceof Double) {
if (((Double) o).isInfinite() || ((Double) o).isNaN()) {
throw new JSONException(
"JSON does not allow non-finite numbers.");
... |
41628f4e-adb4-4cd4-b27e-14311e163a7c | 1 | public AnnotationVisitor visitAnnotation(final String desc,
final boolean visible) {
cp.newUTF8(desc);
if (visible) {
cp.newUTF8("RuntimeVisibleAnnotations");
} else {
cp.newUTF8("RuntimeInvisibleAnnotations");
}
return new AnnotationConstantsCollector(mv.visitAnnotation(desc,
visible), cp);
} |
b52e66b8-c745-48f5-817e-831e75529983 | 7 | protected static boolean testValidity(Object o)
{
if (o != null) {
if (o instanceof Double) {
if (((Double) o).isInfinite() || ((Double) o).isNaN()) {
return false;
}
} else if (o instanceof Float) {
if (((Float) o).isI... |
a8bbace7-1037-44d1-b06d-c072183b14ca | 5 | private final String getNodesString(boolean par1) {
String var1 = "";
for (int i = 0; i < nodes.size(); i++) {
if (i < nodes.size() - 1) {
var1 += (par1 ? "\n" : "") + nodes.get(i) + (par1 ? "\n" : "");
} else {
var1 += nodes.get(i) + (par1 ? "\n" : "");;
}
}
return var1;
} |
977456d1-28da-4052-94d2-c3acd842e8de | 1 | public List<RowType> getRow() {
if (row == null) {
row = new ArrayList<RowType>();
}
return this.row;
} |
6e478453-f98e-42f4-a6ec-1fe8cb068b94 | 6 | public static String reverseWordinString(String string){
int strLeng = string.length()-1;
String reverse = "", temp = "";
for(int i = 0; i <= strLeng; i++){
temp += string.charAt(i);
if((string.charAt(i) == ' ') || (i == strLeng)){
for(int j = temp.length()-1; ... |
e994a631-c731-4a43-98e0-113cc82dca94 | 3 | @Override
public boolean equals(Object obj) {
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
final Juego other = (Juego) obj;
if (this.id != other.id) {
return false;
}
return ... |
19f6a7e0-8a97-4910-ae11-12daa008e526 | 3 | public void testDajZauzeteSobeProvjeraException() {
//Test za provjeru bacanja izuzetka metode dajZauzeteSobe
java.util.Date datumOD= new java.util.Date();
java.util.Date datumDO= new java.util.Date();
java.text.SimpleDateFormat sdf = new java.text.SimpleDateFormat("yyyy-MM-dd");
try{
try {
... |
770084d4-f745-4abf-b2ee-d184ed617649 | 6 | public void attemptAttack(){
if(target != null){
if(Vector2.distance(position, target.position) <= 64){
switch(textureIndex){
case 0:
target.hurt(1, 0, -30);
break;
case 1:
target.hurt(1, 0, 30);
break;
case 2:
target.hurt(1, 30, 0);
break;
case 3:
target.hurt... |
616e8692-c4d2-4e7e-833a-da849d8039fa | 1 | public void paintingbreak(Boolean mode){
if (mode != null){
paintingbreak = mode;
}else{
paintingbreak = true;
}
} |
d1bbf38f-8a87-4e38-b00d-7fa1d9dfde0b | 0 | @Override
public String getDirectory() {
return directory;
} |
14112fb0-68d3-4e0d-9809-f2d3f927e39c | 8 | @Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
PhpposEmployeesEntity that = (PhpposEmployeesEntity) o;
if (personId != that.personId) return false;
if (password != null ? !password.equals(th... |
978e4e83-1c03-4bd3-8cf1-241105b52eda | 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... |
3a264dbf-6b87-41b3-bc2f-3c6937d6811b | 7 | private JSONWriter append(String string) throws JSONException {
if (string == null) {
throw new JSONException("Null pointer");
}
if (this.mode == 'o' || this.mode == 'a') {
try {
if (this.comma && this.mode == 'a') {
this.writer.write('... |
18034401-733e-4ecb-9954-5f07fe47848a | 5 | public String findDrivingDistance(int id,double x,double y,double distance,
String mode, boolean is_reverse_cost) {
String rTable = "road_profile_"+id;
StringBuffer sb = new StringBuffer();
JSONObject jobj = new JSONObject();
JSONObject jstat = new JSONObject();
JSONArray jfeats = new JSONArra... |
e6e20fa1-c21e-4b7f-9494-793eba7aa652 | 8 | public static void keySet(int i, boolean b) {
if (i == KeyEvent.VK_UP) {
keyState[UP] = b;
} else if (i == KeyEvent.VK_LEFT) {
keyState[LEFT] = b;
} else if (i == KeyEvent.VK_RIGHT) {
keyState[RIGHT] = b;
} else if (i == KeyEvent.VK_SPACE) {
keyState[SPACE] = b;
} else if (i == KeyEvent.VK_ENTER) ... |
fb4bb051-102c-443e-91fd-028e1305045d | 8 | public void troopSend(int boat, int foot, int knigth, int siege) {
if(battle!=null){
battle.addTroop(boat,foot,knigth,siege);
}else if(mvInitiated){//on est dans le cas d'un mouvement
territory1.mouveTroops(territory2,boat,foot,knigth, siege );
if(territory1.getTroup()==null){// dans le cas où il n'y a pl... |
b34e7d58-ad30-4695-94e4-def7a8770d90 | 4 | private int partition(int[] data, int low, int high , int order, Random random){
int p = low + random.nextInt(high - low + 1); //important
int sentry = data[p];
swipe(data, p, high);
int index = low;
for(int i=low; i<high; i++){
if(QuickSort.ASCENT == order){
if(data[i] <= sentry){
swipe(... |
4c75f9cb-9be0-4850-8163-f02930c69a66 | 5 | public WinState getState() {
for (FieldSlot[] line: field.getLines()){
if (compareSlots(line)){
if(line[0] == FieldSlot.CROSS)
return WinState.CROSS_WIN;
if(line[0] == FieldSlot.CIRCLE)
return WinState.CIRCLE_WIN;
}
}
if (checkDraw()){
return WinState.DRAW;
}
return WinState.NO_W... |
7787417e-d860-4f00-b519-34b44c916e75 | 6 | public boolean setField(int maxField, int jobNum, int submitTime,
int runTime, int numProc) {
// need to subtract by 1 since array starts at 0.
if (jobNum > 0) {
JOB_NUM = jobNum - 1;
} else if (jobNum == 0) {
throw new IllegalArgumentException("I... |
6f7113cf-37b3-4afe-a211-e318778cdbad | 4 | public String getSongInfo(File file) {
String songInfo = null;
MediaPlayer mp = null;
try {
mp = createMediaPlayer(file.getAbsolutePath());
} catch (MalformedURLException e) {
e.printStackTrace();
}
if (mp != null) ... |
19c2e5aa-1a6e-457c-ac60-c12f992c0d09 | 9 | public void actionPerformed(ActionEvent event)
{
if(event.getActionCommand().equals("Add"))
{
String name = userField.getText().trim();
if (name.equals("") || name.equals("Enter User Name"))
JOptionPane.showMessageDialog(null, "Invalid User Name");
else
{
String key = randomKeyGenerator();
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.