method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
8ad97b11-902d-4f81-bbc7-acd81ade2fb6 | 4 | public Tile getTileAt(final int x, final int y) {
return (x > -1 && x < width && y > -1 && y < height) ? tiles[x][y] : null;
} |
3909abe9-9518-4700-a486-dd138b684b50 | 9 | public TestInfo updateTestSettings(String userKey, String testId, String location,
int engines, String engineType, int usersPerEngine,
int iterations, int rumpUp, int duration, Properties jmeterProperties) {
TestInfo testInfo = new Te... |
540f7dd4-9ae6-4b43-988e-5da8049e9d85 | 6 | public void processEvent(Event event)
{
if (event.getType() == Event.COMPLETION_EVENT)
{
System.out.println(_className + ": Receive a COMPLETION_EVENT, " + event.getHandle());
return;
}
System.out.println(_className + ".processEvent: Received Item Event...");... |
87a54e93-9380-4bb7-aba6-2099e947ef9a | 0 | public void setSolTerminal(String solTerminal) {
this.solTerminal = solTerminal;
} |
539e150d-840a-45b8-b691-f4c470372ee6 | 8 | protected boolean disconnectInput(NeuralConnection i, int n) {
int loc = -1;
boolean removed = false;
do {
loc = -1;
for (int noa = 0; noa < m_numInputs; noa++) {
if (i == m_inputList[noa] && (n == -1 || n == m_inputNums[noa])) {
loc = noa;
break;
}
}
if (loc >= 0... |
bd9cbd0d-4c5e-4494-bc1c-16d3c582f9cf | 2 | public static void main(String[] args) {
char again;
int n, m;
do{
print("Enter the dimensions of the matrix: ");
n = scan.nextInt();
m = scan.nextInt();
double[][] matrix = new double[n][m];
print("\nEnter the data for the matrix: \n");
input(matrix);
print("\nThe transpose is:\n");
print... |
8e590ccf-b5e6-4e37-b951-45e92e57751f | 0 | public Integer getId() {
return id;
} |
b62c1e09-4239-4420-9dcf-022c8263f1cb | 3 | public void readFile() {
FileReader fileReader;
try {
fileReader = new FileReader(new File(FILENAME));
BufferedReader br = new BufferedReader(fileReader);
String line = null;
// if no more lines the readLine() returns null
try {
while ((line = br.readLine()) != null) {
String[] row = ne... |
762d7174-9961-4e0f-8856-8517aaac2499 | 0 | private void testVersions(String ua, Version expectedVersion) {
Version version = Browser.parseUserAgentString(ua).getVersion(ua);
assertEquals(expectedVersion, version);
} |
dd02fbbd-ba57-4e8e-b397-7e0adc07bf14 | 7 | private XTreeCall makeCallPosStarted(XTreeExpr method){
expect(XKeyword.LBRAKET);
List<XTreeExpr> params = new ArrayList<XTreeExpr>();
List<XTreeIdent> kws = new ArrayList<XTreeIdent>();
if(!tokenOk(XTokenKind.KEYWORD, XKeyword.RBRAKET) && !tokenEof()){
XTreeExpr e = makeExpr(true);
if(tokenOk(XTokenKind.... |
e7a74103-fc27-43ca-8dd9-ece137b1a523 | 9 | public void mouseClicked(MouseEvent e) {
//if the mouse was left clicked on
//the node then
if (m_clickAvailable) {
//determine if the click was on a node or not
int s = -1;
for (int noa = 0; noa < m_numNodes;noa++) {
if (m_nodes[noa].m_quad == 18) {
//then is on the screen
... |
54bac4ae-7d17-474a-9417-2830556489fc | 8 | private List<Team> getTopTeams(int numTeams) {
System.out.println("\nDetermining breaks...\n");
System.out.println("Selecting " + numTeams
+ " top teams out of the following:");
// In this case, TeamPlusWeight is a misnomer. Really it's
// TeamPlusBallotCount
ArrayList<TeamPlusWeight> teamsSortedByBallo... |
cb5aa9bb-9511-46e8-989e-8b3894bd8516 | 0 | public int GetAccumulatedPassangersTransported()
{
return accumulatedPassangers;
} |
bbd9c9c0-54c3-4f3d-b75d-9edc1e727620 | 3 | @Test
public void testZipUnzipEnclosingFolder(){
try {
File testFolder = new File(this.getClass().getResource("/ziptest_folder/content_to_zip").toURI());
String testZipFilePath = testFolder.getParent()+ "/zipWithFilesAndFolder.zip";
//Zip the content folder
assertTrue(ZipUtils.zipFolder(testFolder, testZ... |
45870b7d-053a-4bb1-aa40-f25c542c4fb6 | 7 | public void adjust(float[] input,float[] error,float rate,float momentum) {
// проверки
if (input == null || input.length != inputSize ||
error == null || error.length != matrix.length) throw new IllegalArgumentException();
// обновляем веса
float[] output = computeOutpu... |
e21c982a-68fe-4a9c-8d85-a17c76971491 | 1 | private static Type parseType(String sig, Cursor c) throws BadBytecode {
Type t = parseObjectType(sig, c, true);
if (t == null)
t = new BaseType(sig.charAt(c.position++));
return t;
} |
56efaeb7-a009-46e4-b934-56f3c1bd4e44 | 7 | public void nJump(Piece piece) {
ArrayList<Tile> jumpTargets = new ArrayList<Tile>(this.jumpTargets);
ArrayList<Tile> newTargets = new ArrayList<Tile>();
if(jumpTargets.isEmpty())
return;
this.isNJumping = true;
for(Tile t: jumpTargets) {
this.lastJumpTile = t;
// System.out.println("for loop10");... |
9ec5bc5d-2e36-4aa7-bcde-ca719ec1016c | 3 | public synchronized void start(int... ports) {
if (ports != null && ports.length > 0) {
// TODO set ports
}
if (!listening) {
listening = true;
(new Thread(this)).start();
}
} |
b9b82a14-123d-4161-b5e3-8c54a9d865f4 | 1 | @Override
public void addRecordToDB() {
// add to database
try {
String statement = new String("INSERT INTO " + DBTable
+ " (qid, userid, timespan, score, isfeedback, ispractice)"
+ " VALUES (?, ?, ?, ?, ?, ?)");
PreparedStatement stmt = DBConnection.con.prepareStatement(statement, new String[] {... |
bc90aea9-5b20-45b0-b39c-c6da1d25b118 | 0 | @Override
public String getDesc() {
return "Default";
} |
3fc111f4-e05f-469f-94a0-1c88311aad2b | 9 | @Override
public void internalQuestDelete()
{
if(isCopy())
return;
if((internalFiles!=null)&&(internalFiles.size()>0))
{
for(int i=0;i<internalFiles.size();i++)
{
final String filename=((String)internalFiles.elementAt(i,1)).toUpperCase();
final Vector<String> delThese=new Vector<String>();
... |
ab06a20d-ca92-400c-b2c1-c4409c104a65 | 1 | @Override
public void stop() {
if (pAccessToken != null) {
minecraftClosed(pAccessToken);
}
} |
b4c80f35-d785-44ef-960f-f38931ef9521 | 4 | public void sendServerMessage(String message) {
ArrayList < Client > tclients = new ArrayList < Client > ();
tclients.addAll(clients);
for (int i = 0; i < channels.size(); i++) {
ArrayList < Client > clients = channels.get(i).getUsers();
for (Client c: clients) {
... |
8b871aba-d9ad-4160-b796-670f6345d210 | 4 | @Test
public void testToStringServerMessageQueueEmpty() {
LOGGER.log(Level.INFO, "----- STARTING TEST testToStringServerMessageQueueEmpty -----");
try {
server1.setUseMessageQueues(true);
} catch (TimeoutException e) {
exception = true;
}
try {
... |
3b9d5383-c37c-4a4a-bbfd-c46d4dffb42a | 1 | private List<Image> linkImages(List<Image> images) {
for (int i = 0; i < images.size(); i++) {
Image image = images.get(i);
image.setNext(images.get((i+1) % images.size()));
image.setPrev(images.get((i+images.size()-1) % images.size()));
}
return images;
} |
7a82a4c4-cd7d-4e62-8dc3-63ad6cd5d10f | 3 | public static String pastPrices(String stock) {
String httpdata = getHtml(yahoobase + "/hp?s=" + stock);
if (!httpdata.contains("Adj Close"))
return "HISTORIC";
httpdata = removeHtml(
reformat(httpdata.substring(httpdata.indexOf("Adj Close"))),
false);
httpdata = httpdata.substring(0, httpdata.lastI... |
bf9f8ad6-5d4d-4cdb-9d6c-802e527014ff | 6 | public String query_post(String uri, java.util.List<? extends NameValuePair> parameters, java.util.List<? extends NameValuePair> data) {
Formatter f=new Formatter();
for (NameValuePair entry:data) {
if ("setpoint".equals(entry.getName())) {
Double value=null;
try {
value=Double.p... |
b88c2e41-f488-4f43-a8c0-b776bbd03a61 | 7 | public void computeToBeAllocatedObjs() {
long shuffleBound = reducer.getSegsInShuffle().getShuffleBound();
Set<Integer> inMemorySegIds = new HashSet<Integer>();
inMemorySegIds.addAll(processedSegs);
long inMemSegsBytes = 0;
for(SegmentObj seg : segsInCopy) {
inMemorySegIds.add(seg.getTaskId());
inMe... |
121fc12e-78a7-4b9b-a148-e540c811bf67 | 1 | public void testWithFieldAdded3() {
DateMidnight test = new DateMidnight(2004, 6, 9);
try {
test.withFieldAdded(null, 6);
fail();
} catch (IllegalArgumentException ex) {}
} |
62f169e2-a56c-4e46-a295-90ae94c1f599 | 7 | private void handle_log(String[] cmd) {
if (!is_admin()) // Only Admin can change log settings
return;
if (cmd.length == 1) { // Admin clears user list
disp.clear_user_log();
cliprint("No users to log." + VT100.crlf);
return;
}
if (cmd[1].equals("*")) {
disp.clear_user_log();
disp.add_user_lo... |
3fa5b2fc-13cf-4bad-aae0-a63dd673f481 | 7 | public static void ask(){
try{
System.out.println("Pick a save file to load or start a new file (Type in 'Create' or 'Load')");
System.out.print(">");
input = br.readLine();
switch(input){
case "Create":
case "create":
input = "CREATE";
break;
case "Load":
case "load":
input = ... |
57689222-2bfc-4479-b992-47575c96f79d | 1 | public static void update() {
for (int i = 0; i < NUM_KEYS; i++)
prevKeyState[i] = keyState[i];
} |
0135948e-c132-458a-bb41-8e28f6621508 | 2 | private static BigInteger sqrt(BigInteger n) {
BigInteger a = BigInteger.ONE;
BigInteger b = new BigInteger(n.shiftRight(5).add(new BigInteger("8")).toString());
while(b.compareTo(a) >= 0) {
BigInteger mid = new BigInteger(a.add(b).shiftRight(1).toString());
if(mid.multiply(mid).compareTo(n) > 0... |
880b0a80-80d4-4370-b2fd-b6a8af3af656 | 2 | static void realSkip(InputStream is, long bytesToSkip) throws IOException {
long skipped = 0, value;
while (skipped < bytesToSkip) {
value = is.read();
if (value < 0) {
throw new RuntimeException("EOF!");
}
skipped++;
skipped += is.skip(bytesToSkip - skipped);
}
} |
07e1da02-15e8-468b-a5d2-963267038f86 | 4 | public void listenerAdaline(final AdalineContainer adalineGui){
adalineGui.btnAgregarSetAprendizaje.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
DefaultTableModel temp = (DefaultTableModel) adalineGui.tablaSetAprendizaje.getModel();
Object nuevo[]= ... |
a8465311-2355-4dd3-8b3c-03a639cf8f39 | 1 | @Override
public String getName() {
String name = super.getName();
if (name == null) {
return DEFAULT_NAME;
} else {
return name;
}
} |
959d5dd2-d15a-4ccb-9ca6-a0ce06c86330 | 1 | public void setOptstring(String optstring) {
if (optstring.length() == 0)
optstring = " ";
this.optstring = optstring;
} |
1731cfef-c000-4cbc-bf1b-484a7086032c | 7 | private void move() {
if (currentMovementSteps < totalMovementSteps) {
currentMovementSteps++;
if (moveVector == null) {
return;
} else {
double[] center = generator.getCenter();
boolean outofbounds =... |
3f69d4b4-af73-4df2-8433-870e6667cd25 | 1 | public float div(int a, int b) {
float value = 0;
try {
value = math.razdelit(a, b);
} catch (ArithmeticException aex) {
ProxyClient.addOutput("dividing by zero:");
}
return value;
} |
180750c8-40d8-42df-9dfc-7d359fff11a7 | 8 | public static void main(String[] args) {
int[] possibleNums = new int[100];
int[] possibleDems = new int[100];
for (int i = 1; i < 100; i++) {
possibleNums[i] = possibleDems[i] = i;
}
int num = 1, den = 1;
for (int i : possibleNums) {
for (int j : possibleDems) {
if (i >= 10 && j >= 10) {
... |
a79cc874-0527-4bb4-928f-8ed93ee16ea8 | 7 | @Override
public boolean execute(CommandSender sender, String[] args) {
if ((args.length == 1) || args.length == 2) {
OfflinePlayer p = null;
if (args.length == 2) {
p = Bukkit.getOfflinePlayer(args[1]);
} else if (args.length == 1 && sender instanceof Pla... |
a76234a7-065f-4253-b0e9-3e90c33b6697 | 0 | public String getAccountAcl() {
return this.accountAcl;
} |
bcc58bae-c41d-4ead-aa6d-99c85b9d88e5 | 4 | public Integer nthFibonacci(int n){
if(n<0){
return null;
}
if(n==0){
return 0;
}
if(n==1 || n==2){
return 1;
}
else{
return nthFibonacci(n - 1)+nthFibonacci(n-2);
}
} |
fb9543f5-acd3-451b-a14d-576a0ffea57a | 5 | @Override
public void validate() {
if (platform == null) {
addActionError("Please Select Platorm");
}
if (location == null) {
addActionError("Please Select Location");
}
if (iphone.equals("Please select")) {
addActionError("Please Sele... |
953a91b1-d3a1-4bdd-9499-5b9f2b73d1bd | 7 | public void handleInput() {
if (Keys.isPressed(Keys.ESCAPE))
gsm.setPaused(true);
if (player.getHealth() == 0)
return;
player.setUp(Keys.keyState[Keys.UP]);
player.setDown(Keys.keyState[Keys.DOWN]);
player.setLeft(Keys.keyState[Keys.LEFT] || Keys.keyState[Keys.A]);
player.setRight(Keys.keyState[Keys.R... |
56b2dab5-f4a8-435f-b4cd-0ed53d075d12 | 3 | @SuppressWarnings("unchecked")
public <T> T apiRequest(String url, T classObject) {
try {
URL apiURL = new URL(this.apiUrl + url);
URLConnection conn = apiURL.openConnection();
conn.setRequestProperty("User-Agent", this.userAgent);
InputStream is = conn.getInputStream();
Serializer serializer = new Pe... |
0482da29-6d29-4f2f-95e0-44dae04f3d8e | 8 | private int fichasInvert(int x, int y,int ficha, int[][] estAct){
int[][] estTemp = new int[estAct.length][estAct.length];
for(int i=0;i<estAct.length;i++)
for(int j=0;j<estAct.length;j++)
estTemp[i][j] = estAct[i][j];
int cont = 0;
if(verificarDiagonalInferio... |
944f5473-2a92-41e9-af31-ac36268255bd | 7 | @SuppressWarnings("unchecked")
public void gainedGrace(Player player, AGPlayer agp, God god, Praying praying) {
//calculating if player gets grace randomly
double random = Math.random()*100;
if(random <= praying.getChance()) {
//exp as benefit
if(praying.getBenefit().getString("type").equalsIgnoreCa... |
082360b4-252c-48c4-b419-e49daf62d317 | 0 | public String toString() {
return Thread.currentThread().getName() + "(" + countDown + "), ";
} |
64875e67-1092-49b5-890d-dd7569a6513d | 2 | public void init() {
Map<String, Ban> rawMap = BanMapLoader.load("./plugins/TimeBan/banlist.dat");
bans = Collections.synchronizedMap(rawMap);
if(bans == null || bans.isEmpty()) {
bans = Collections.synchronizedMap(new TreeMap<String, Ban>());
}
} |
ae3254e3-70a5-4480-8765-deea795a5e8f | 7 | public synchronized void emailUser(User user, String message, String subject, boolean emailme) throws IOException, CredentialException
{
long start = System.currentTimeMillis();
// check if blocked, logged in
if (this.user == null || !this.user.isAllowedTo("sendemail"))
throw ne... |
28eca503-1daa-42cb-8f2c-9712fbfcb46a | 6 | private List<int[]> generateHeaps(int valueBound, int size, int[] left) {
// Generates heaps of 'size' elements; i-th element in [left[i], valueBound).
// If left is null, generates a min-heap. Otherwise, a max-heap.
// left.size is guaranteed == either size or size+1.
// If left.size ==... |
00c744e5-2b29-423f-ad21-60b2357bab30 | 1 | public Rectangle getRectangle(int index) {
try {
return Geometry.toRectangle(getString(index));
} catch (Exception exception) {
return new Rectangle();
}
} |
49724456-9608-4913-b5d6-0008f4cdea96 | 1 | public static ConnectionManager getInstance() {
if (instance == null) {
instance = new ConnectionManager();
}
return instance;
} |
7a11b5a3-25ba-413b-a49b-bcef5ac2ecef | 0 | public boolean isActive() {
return isActive;
} |
c077cdc9-43c6-4d45-8fd0-c0bd20e1bd57 | 5 | @SuppressWarnings("unchecked")
public void loadPlayers() {
ConfigurationSection playerData = persist.get().getConfigurationSection("players");
if (playerData == null)
persist.get().createSection("players");
for (Player player : Bukkit.getOnlinePlayers()) {
ChatPlayer p = new ChatPlayer(player.getName(), na... |
8c344f43-582d-4f74-9aae-0887e64ff735 | 0 | public static int getCounter() {
int temp = counter;
counter = 0;
return temp;
} |
c1a91621-3e12-4b84-86c9-723b51832f83 | 8 | final void method624(int i, int i_477_, int i_478_, int i_479_) {
if ((mask & 0x80000) != 524288)
throw new IllegalStateException("FMT");
for (int i_480_ = 0; i_480_ < anInt5351; i_480_++) {
int i_481_ = aShortArray5311[i_480_] & 0xffff;
int i_482_ = i_481_ >> 10 & 0x3f;
int i_483_ = i_481_ >> 7 &... |
4def3af1-eaa3-4c17-be96-9c9dcf265555 | 6 | protected boolean sendSomeOutgoingData( TCPSession sess ) throws Exception {
SocketAddressPair rap = sess.rap;
boolean anythingSent = false;
if( sess.combine ) {
anythingSent = sendData( rap, sess.outBuf, !sess.outBuf.synAcked, true, true, sess.inputSequence );
} else {
if( !sess.outBuf.synAcked ) {
... |
fb79ad11-85c1-4e69-91a1-72bc2e2415af | 4 | public TreeRow selectToHome(boolean extend) {
TreeRow scrollTo = null;
if (mRoot.getChildCount() > 0) {
scrollTo = getFirstRow();
if (extend && !mSelectedRows.isEmpty()) {
if (mAnchorRow == null) {
mAnchorRow = getLastSelectedRow();
}
select(scrollTo, mAnchorRow, true);
} else {
select... |
43133734-b9c0-4f40-9afc-87d8984951a6 | 5 | public static void setbelt(int slot, Indir<Resource> res) {
synchronized (defbelt) {
defbelt[slot] = res;
}
if (res == null) {
for (ToolbarWnd tb : UI.instance.menugrid.toolbars)
tb.removedef(slot);
MenuGrid mnu = UI.instance.menugrid;
... |
131b1d96-a9a1-439d-b173-100f320b9ad6 | 0 | public HumanPlayer(boolean w) {
white = w;
} |
06373a7b-1ddb-4ff5-ac0c-413f8531904b | 8 | public static void primeGen() {
// prepare array
for(int i=0; i<max; i++) numberPool[i]=false;
// tick off 0 and 1, so that following loops are simpler
numberPool[0]=true;
numberPool[1]=true;
// NB: in numberPool the false numbers end up being prime
for(int i=0; i<max; ++i) {
... |
79c04eaf-14e6-470b-ad29-de9f13da93a4 | 1 | @EventHandler (priority = EventPriority.HIGHEST)
public void MutedPlayer(AsyncPlayerChatEvent e) {
Player p = e.getPlayer();
if(Mute.isMuted(p)) {
e.setCancelled(true);
}
} |
090f3cbd-ee05-4c7b-84c9-2dfd3c586e19 | 0 | public static HandlerConfigurationsBuilder createClassPathFromJVM()
{
return createClassPathFromPath( System.getProperty( JAVA_CLASS_PATH ) );
} |
8e97f400-d851-4b75-99a3-3eeb9493ee46 | 4 | public void body() {
// get the resource characteristics object to be used
dynamics = (ResourceDynamics)super.resource_;
// Gets the information on number of PEs and rating
// of one PE assuming that the machines are homogeneous
ratingPE = dynamics.getMIPSRatingOfOnePE();
... |
621dc3fe-f7c9-41ae-829c-acff173b4e1b | 7 | @Override
public void executeMsg(Environmental host, CMMsg msg)
{
if((msg.source()==affected)
&&(msg.target() instanceof Room)
&&(msg.tool()==null)
&&((msg.targetMinor()==CMMsg.TYP_LOOK)||(msg.targetMinor()==CMMsg.TYP_EXAMINE))
&&(((((Room)msg.target()).myResource()&RawMaterial.MATERIAL_MASK)==RawMaterial.M... |
edbad2ed-11ec-4e13-9310-3a221c8458a7 | 5 | public ArrayList<Integer> identicalColumns(){
ArrayList<Integer> ret = new ArrayList<Integer>();
int nIdentical = 0;
for(int i=0; i<this.numberOfColumns; i++){
for(int j=i+1; j<this.numberOfColumns-1; j++){
int m = 0;
for(int k=0; k<this.numberOf... |
1fdce033-ad6b-48b7-8614-f46a4b3570ab | 4 | private void drawLines(Graphics g) {
g.setColor(Color.BLUE);
for (int longitude = -180; longitude <= 180; longitude++) {
for (int latitude = -90; latitude <= 90; latitude += 10) {
int x = sphereConverter.giveWindowXCoordinate(longitude*Math.PI/180, latitude*Math.PI/180);
int y = sphereConverter.giveWindo... |
ffcf2a4f-2979-416e-be92-e3b04fe48f40 | 1 | int exeute() throws ClassNotFoundException, InstantiationException, IllegalAccessException, SQLException {
Class.forName("com.mysql.jdbc.Driver").newInstance();
Connection con = DriverManager.getConnection(url, dbUser, dbPass);
Statement stm = con.createStatement();
String query = "SELE... |
0e922395-534b-4426-9c2f-5b93e2188ebb | 2 | private int diasEntre(Periodo periodo){
Calendar comeco = periodo.getLimiteInferior();
Calendar fim = periodo.getLimiteSuperior();
Calendar data = (Calendar)comeco.clone();
int diasEntre = 0;
if(comeco.equals(fim)){
diasEntre = 2; /... |
a87d4b6d-4ee6-4a3c-98bf-3df59a943d1f | 6 | public SelectionField () {
super (SEARCHTERM, 12);
setMaximumSize (getPreferredSize());
setMinimumSize (getPreferredSize());
setHorizontalAlignment (JTextField.RIGHT);
addFocusListener (new FocusListener () {
public void focusGained (FocusEvent e) {
if (getText().equals (SEARCHTERM)) setText ("");
... |
8bfb4515-42ef-4e23-90b4-7a0781888b86 | 1 | private void loadFile() {
try {
String cd = System.getProperty("user.dir") + "/files/";
System.out.println(cd);
textPane.setPage("File:///" + cd + "test.html");
} catch (IOException ex) {
Logger.getLogger(TextPaneExample.class.getName()).log(Level.SEVERE, null, ex);
}
} |
67d6ae06-9f55-4a11-9081-ade2015cdf68 | 1 | public static Filter annotatedWith( Annotation annotation )
{
if ( annotation == null )
{
throw new IllegalArgumentException( "Parameter 'annotation' must not be null" );
}
checkForRuntimeRetention( annotation.annotationType() );
return new AnnotatedWith( annota... |
c886fc8b-a62b-40d9-ade1-062825a2b2ec | 3 | public void setDocument(Document doc) throws DOMException, TransformerException, XPathExpressionException, IllegalArgumentException, IllegalAccessException, IOException {
CDATASection section = null;
Node first = this.node.getFirstChild();
if(first != null) {
if(first.getNodeType() == Node.CDATA_SECTION_NODE)... |
0c94f666-db8e-44b1-a5fd-ccf21c53de24 | 5 | private void parsePathElements(String string){
// /this/is/the/path?name1=value1&name2=value2....
string = string.toLowerCase();
List<String> pathList = new ArrayList<String>();
int indexQuestMark = string.indexOf("?");
if(indexQuestMark != -1){
string = string.substring(0, indexQuestMark);
}
while (st... |
96b6cce3-4c41-4985-a093-b33b9dca9c4c | 0 | @Override
public String toString(){
return "SimpleAI(" + ID + ")";
} |
b5370f22-da65-4152-8339-6ae0c832fea3 | 9 | public static void enterDonatorzone(final Player player) {
Magic.sendNormalTeleportSpell(player, 0, 0, new WorldTile(2582, 3910, 0));
for (int regionId : player.getMapRegionsIds()) {
List<Integer> npcIndexes = World.getRegion(regionId).getNPCsIndexes();
if (npcIndexes != null) {
for (int npcIndex : npcInd... |
6aa65b00-f97a-494d-99b1-83881f4e9605 | 8 | public Wave10CeruleanGym(){
super();
MobBuilder m = super.mobBuilder;
for(int i = 0; i < 125; i++){
if(i < 55){
if(i % 2 == 0)
add(m.buildMob(MobID.SHELLDER));
else
add(m.buildMob(MobID.HORSEA));
}
else if(i >= 55 && i < 60)
add(m.buildMob(MobID.GOLDEEN));
else{
if(i >= 60 &&... |
d1d7f8dd-3e4a-47c8-9e4f-b36ce21e7f9b | 5 | @Override
int inverse2(Block vb, Object i, Object memo, float[] out) {
LookFloor1 look = (LookFloor1) i;
InfoFloor1 info = look.vi;
int n = vb.vd.vi.blocksizes[vb.mode] / 2;
if (memo != null) {
/* render the lines */
int[] fit_value = (int[]) memo;
... |
a3baa057-7595-4784-b7e4-757692746828 | 2 | @Override
public int compareTo(BaseSize baseScore) {
if (size < baseScore.size) return -1;
if (size > baseScore.size) return 1;
return 0;
} |
dcedb774-2d26-4001-9cb5-53a4d47a6d3d | 3 | public String toString() {
if (im == 0) return re + "";
if (re == 0) return im + "i";
if (im < 0) return re + " - " + (-im) + "i";
return re + " + " + im + "i";
} |
718a0c65-9f6e-4c3d-8b82-5dd02fb9bbb0 | 9 | public boolean isTraversable(Rectangle r) {
if (r.x / Tile.WIDTH < 0 || r.y / Tile.HEIGHT < 0 || r.x / Tile.WIDTH >= WIDTH || r.y / Tile.HEIGHT >= HEIGHT)
return false;
ArrayList<Tile> tilesunder = new ArrayList<Tile>();
for (int i = 0; i < WIDTH; i++)
for (int j = 0; j <... |
bea6961e-e222-4f2f-afd7-e7b48217c9c1 | 1 | @Test
public void testCharge() {
System.out.println("Test charge()");
floorType newFloorType = floorType.HIGH_PILE_CARPET;
BatteryAndDirtBin instance = new BatteryAndDirtBin(newFloorType);
instance.swept();
instance.swept();
instance.swept();
instance.swept();
assertEq... |
7148c81c-3c66-4d08-97f9-bec09d3d9fe5 | 0 | public Human getHuman() {
return human;
} |
68bc3496-d0ef-45c3-8fa2-87dc9e68332b | 5 | public RemoteMinecraft(String address)
{
client = new Client(65536, 65536);
Kryo kryo = client.getKryo();
kryo.register(NetCreateWorldRequest.class);
kryo.register(NetGetBiomeDataRequest.class);
kryo.register(NetGetBiomeDataResult.class);
kryo.register(NetBiome.class)... |
e9b13859-235a-4062-bc38-ebd76c93ea55 | 6 | public void backupFile(String filename, int replicationDegree) {
BackupFile newFile = null;
byte[] fileHash = computeFileHash(filename);
if(fileHash != null) {
for(BackupFile file : files) {
if(Packet.bytesToHex(file.getFileID()).equals(Packet.bytesToHex(fileHash))) {
System.out.println("File alrea... |
fcddee26-a9d8-40f8-b72f-750d8a2f06c8 | 3 | public void desconectarBaseDeDatos(){
//metodo de desconexion
try{
if(conexion !=null){
if (sentencia !=null){
//si la conexion devuelve valores nulos
sentencia.close();
}
conexion.close();
}
... |
7be78b8b-612a-46ac-8882-2d42036e3646 | 4 | private void initListeners(JMenu menu) {
Component[] cmps = menu.getMenuComponents();
for (Component c : cmps) {
if (c instanceof JMenu) {
initListeners((JMenu) c);
} else if (c instanceof JMenuItem) {
JMenuItem i = (JMenuItem) c;
for (ActionListener l : i.getActionListeners()) {
i.removeActi... |
6ef8202c-fe2b-407b-82f8-40bdcd84c586 | 0 | @Test
public void testMakePurchaseWithFee() {
this.card1.makePurchase(700);
assertEquals(750, this.card1.getBalance());
} |
5f152a68-2d2d-4842-b06f-b0754bc15915 | 8 | public int numDecodings(String s) {
if (s == null || s.length() == 0) {
return 0;
}
if (s.charAt(0) == '0') {
return 0;
}
int[] number = new int[s.length() + 1];
number[0] = 1;
number[1] = 1;
int tmp;
for (int i = ... |
6b89062f-693e-4e67-b942-a76168035685 | 4 | public void DeletePHPFileFromDatabase(DatabaseAccess JavaDBAccess, String TargetPHPFileSelectedComboBox) {
PreparedStatement ps = null;
Connection conn = null;
try {
int n = 0;
n = JOptionPane.showConfirmDialog(new JFrame(), "Do you want to delete from the database\nthe ... |
df055080-285e-4cf2-a5bc-04d12c0a0e32 | 0 | public String[] getLabels() {
return labels;
} |
2b9390e4-c072-4bd1-80ea-62b9d5244a32 | 9 | private void initialize() {
Tools.SIMPLIFICATION_ENABLED = true;
frmMbqcSimulatorValpha = new JFrame();
frmMbqcSimulatorValpha.setTitle(PROG_TITLE);
frmMbqcSimulatorValpha.setBounds(100, 100, 933, 618);
frmMbqcSimulatorValpha.setDefaultCloseOperation(JFrame.HIDE_ON_CLOSE);
frmMbqcSimulatorValpha.getCo... |
17f61464-d175-46cb-9597-c7839073607c | 6 | @EventHandler
public void PigZombieMiningFatigue(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.getPigZombieConfig().getDouble("Pi... |
1b0e660d-dd60-4260-99fb-9092948ce507 | 2 | public static AESKeyObject fromByteArray(byte[] array){
try{
ByteArrayInputStream bis = new ByteArrayInputStream(array);
ObjectInput in = null;
in = new ObjectInputStream(bis);
Object o = in.readObject();
try{
bis.close();
in.close();
}catch(Exception e){System.out.println("A Memory Leak Ha... |
421e4eee-d2bb-425e-8e5f-571178897304 | 7 | public static void main(String[] args){
Scanner in = new Scanner(System.in);
n =in.nextInt();
cost = new int[n+1];
visited = new boolean[n+1];
g.add(new ArrayList<Integer>());
gR.add(new ArrayList<Integer>());
for(int i=1;i<=n;i++){
cost[i]=in.nextInt();
visited[i]=false;
g.add(new Array... |
20632329-ca32-488e-9deb-080c0d0f4f8e | 8 | @Override
public void e(float sideMot, float forMot) {
if (this.passenger == null || !(this.passenger instanceof EntityHuman)) {
super.e(sideMot, forMot);
this.W = 0.5F; // Make sure the entity can walk over half slabs,
// instead of jumping
return;
}
EntityHuman human = (EntityHuman) this.passe... |
a7ffde90-fd2a-486d-839e-900e4e618f3f | 6 | public static void main(String[] args) {
final String ABOUT = "-about";
String inFile = "";
final int NUMBERS_OF_ARG = 1;
// Echo the entered arguments.
for (int i = 0; i < args.length; i++) {
if (i == args.length - 1) {
System.out.print(args[i]);
} else {
System.out.print(args[i] + " ");
}
... |
3bc97a65-c9ca-48d7-ab9c-e3b2c1dc5546 | 6 | private static int partition(Comparable[] a, int lo, int hi) {
int i = lo, j = hi + 1;
while (true) {
while (a[++i].compareTo(a[lo]) < 0) {
if (i == hi) break;
}
while (a[lo].compareTo(a[--j]) < 0) {
if (j == lo) break;
}
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.