method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
4a9c87dd-ddd3-4249-8fc9-bcc7305d08f2 | 0 | public boolean isChange() {
return myChange;
} |
ecf7b9d4-bd92-44f4-82ad-229345d94e90 | 3 | public double getSimilarity(String a, String b) {
LinkedList<String> pairs1 = wordLetterPairs(a.toUpperCase());
LinkedList<String> pairs2 = wordLetterPairs(b.toUpperCase());
int intersection = 0;
int union = pairs1.size() + pairs2.size();
for (int i = 0; i < pairs1.size(); i++) {
Object pair1 = pairs1... |
a22b2d4e-f4b0-46c1-a631-ababec3fe90b | 7 | private void calculateBestTime(double recordBest, double newTime){
int secondsBehind;
int secondsAhead;
if(((recordBest <= 0)&&(newTime <= 0))||(newTime <= 0))
System.out.println("Invalid Time. \n");
else if (recordBest == 0) {
System.out.println(+newTime + ... |
723cc50b-6a17-43fe-9393-cfb637f3a5d3 | 2 | public String join(String separator) throws JSONException {
int len = length();
StringBuffer sb = new StringBuffer();
for (int i = 0; i < len; i += 1) {
if (i > 0) {
sb.append(separator);
}
sb.append(JSONObject.valueToString(this.myArrayList.g... |
0db5c028-0b92-4f91-8907-fb5d42eb2b9c | 1 | @Override
public void write(int b) throws IOException {
// Debugger.println(2, "[DummyConnection] writing " + (char)b);
if(dataSemaphore.availablePermits() > QUEUE_BUFFER_LIMIT) {
throw new IOException("Buffer size limit reached!");
} else {
synchronized(dataQueue) {
dataQueue.add(b);
dataS... |
2a845c69-1671-4d9b-a47b-039e314242c2 | 8 | public static double svm_predict_probability(svm_model model, svm_node[] x, double[] prob_estimates)
{
if ((model.param.svm_type == svm_parameter.C_SVC || model.param.svm_type == svm_parameter.NU_SVC) &&
model.probA!=null && model.probB!=null)
{
int i;
int nr_class = model.nr_class;
double[] dec_val... |
b19cd6cd-e105-4eb8-b51c-fddf51211757 | 0 | public String getLibelle() {
return libelle;
} |
50d7d999-f6fc-4bfa-b1d3-5ab25b55e943 | 9 | public RequestsArray(int numberOfElements, float sDev) {
this.meanBuyPrice = 1.0f;
this.meanSellPrice = 1.0f;
this.sDev = sDev;
this.numberOfElements = numberOfElements;
for(int i = 0; i<numberOfElements; i++){
float targetPrice;
int sORb = rng.nextInt(2);... |
98616bc8-73d6-4104-925d-0f38879ae1a6 | 1 | public Movie registerMovie(Movie movie) {
int index = movies.indexOf(movie);
if (index == -1) {
addMovie(movie);
return movie;
} else
return movies.get(index);
} |
3fa46e7e-16f7-410a-af79-61340605d8bb | 9 | public static void main(String[] args) throws IOException {
// TODO Auto-generated method stub
System.out.println("Program Started");
//get config elements
main_image_compressor m =new main_image_compressor();
//validate config elements
if(!config_reader.validate_config(prop))
return ;//incorrect config
... |
0cb79910-f394-4022-b43c-83cd61cbbf88 | 1 | public T Abrir(Long id) {
try {
T obj = (T) manager.find(tipo, id);
return obj;
//abrir
} catch (Exception ex) {
return null;
}
} |
374912c7-4b29-41eb-898d-720f79ed0565 | 9 | public void appendPath(String p_addToPath) throws MalformedURIException
{
if (p_addToPath == null || p_addToPath.trim().length() == 0)
{
return;
}
if (!isURIString(p_addToPath))
{
throw new MalformedURIException(Utils.messages.createMessage(MsgKey.ER_PATH_INVALID_CHAR, new Object[]{p... |
31c09b6d-8ab6-49d7-a84c-dc83f33628a9 | 7 | @Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
MapKey other = (MapKey) obj;
if (documentId != other.documentId)
return false;
if (term == null) {
if (other.term != null)
return fal... |
9045d240-1bbf-475e-96d4-d051e94aa859 | 5 | public static boolean isReservedOpenParen(String candidate) {
int START_STATE = 0;
int TERMINAL_STATE = 1;
char next;
if (candidate.length()!=1){
return false;
}
int state = START_STATE;
for (int i = 0; i < candidate.length(); i++... |
d5e5c39e-3b76-4f30-9286-f39d6e79f4a7 | 1 | @Override
public int attack(double agility, double luck) {
if(random.nextInt(100) < luck)
{
System.out.println("I just breathed darkness!");
return random.nextInt((int) agility) * 2;
}
return 0;
} |
004e3dc2-43d6-457e-9ce9-04a8094fdbad | 7 | public Kill04(String data){
if(!data.trim().equalsIgnoreCase("")){
String[] info = data.split(";");
String killer = info[0];
String victem = info[1];
int points = new Integer(info[2]);
if(killer.equals(Main.playername)){
//Du hast jem... |
a380122e-651f-4497-b915-9c8e50438b7a | 1 | private String readFile(File eventFile) throws IOException {
BufferedReader reader = new BufferedReader(new FileReader(eventFile));
StringBuilder sBuilder = new StringBuilder();
try {
String line = reader.readLine();
while (line != null) {
sBuilder.append(... |
e5b59027-d6cc-42f0-94c2-0bd2557feebc | 5 | public static boolean isPrime( long x) {
long max = (long)Math.sqrt(x);
if( x ==2) {
return true;
}
if( x % 2 ==0) {
return false;
}
if( x <= 1) {
return false;
}
for( int i = 2; i <= max; i++) {
if( x % i ==0) {
return false;
}
}
return true;
} |
3561d5c5-ab4b-468e-b852-1b2e66b4325c | 1 | public boolean requiresVote(){
if(Plugin.getJobsConf().getBoolean(name + ".requires-vote")){
return true;
}else{
return false;
}
} |
9f413d32-82e7-41e0-a5b2-43542c40d002 | 1 | public ArrayList getImages(String name) {
ArrayList imsList = (ArrayList) imagesMap.get(name);
if (imsList == null) {
//EIError.debugMsg("No image(s) stored under " + name, EIError.ErrorLevel.Warning);
return null;
}
EIError.debugMsg("Returning all images stored ... |
8ea267df-abc7-4c2d-b2d9-76cb56aabf18 | 6 | public int HandleCollisionWithBullet(Bullet b)
{
ChainEnemyTailPiece iterator = mFirstTailPiece;
while (iterator != null)
{
Vector2 intersection = iterator.GetBulletCollision(b);
if (intersection != null)
{
int returnPoints = 0;
if (b.IsAlive() && iterator.IsAlive() && iterator.GetNe... |
c32d5362-342e-46c7-9b89-2ec4be5ab543 | 8 | public static void main(String[] args) throws Throwable {
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
StringBuilder sb = new StringBuilder();
for (String line; (line = in.readLine())!= null; ) {
int casos = Integer.parseInt(line);
if(casos==0)break;
courses = new String[caso... |
7ee4df72-a006-4457-87a4-3f4242ce7162 | 5 | public void calculateDayOfWeek(Calendar cal, Date currentTime) {
Integer nextOccurence = null;
for(int d : repeatDays) {
cal.set(Calendar.DAY_OF_WEEK, d);
if(cal.getTime().after(currentTime)) {
nextOccurence = d;
break;
}
}
... |
3338b15e-ed5b-4058-8b44-2a2a0dc834fc | 6 | private void stop() {
if (isMovingRight() == false && isMovingLeft() == false) {
speedX = 0;
}
if (isMovingRight() == false && isMovingLeft() == true) {
moveLeft();
}
if (isMovingRight() == true && isMovingLeft() == false) {
moveRight();
}
} |
f17c57df-39b4-47d9-869b-5da6c193628d | 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... |
320d5abf-321f-486a-8250-8e537a78437c | 7 | public void draw(Graphics g) {
boolean selected = (needsHighlight() || sim.getPlotYElm() == this);
Font f = new Font("SansSerif", selected ? Font.BOLD : 0, 14);
g.setFont(f);
g.setColor(selected ? selectColor : whiteColor);
String s = (flags & FLAG_VALUE) != 0 ? getVoltageText(vo... |
926a945d-b0bb-41a1-ab53-5602f6cb464f | 8 | * @param leftTransposed the left transpose MUM possibly null
* @param rightTransposed the right transpose MUM possibly null
* @return null or the best MUM
*/
private MUM getBest( MUM direct, MUM leftTransposed,
MUM rightTransposed )
{
MUM best = null;
// decide which transpose MUM to use
MUM transposed... |
7fc41446-8a2f-4d6d-a07e-e4e8c8c798b1 | 8 | public static SphericalCoordinate jauAtoiq(String type,
double ob1, double ob2, Astrom astrom
)
{
char c;
double c1, c2, sphi, cphi, ce, xaeo, yaeo, zaeo, v[] = new double[3],
xmhdo, ymhdo, zmhdo, az, sz, zdo, refa, refb, tz, dref,
zdt, xaet, yaet, zaet, xmhda... |
9b125f26-70ce-40c9-bcbf-31b59375f28c | 6 | public TreeNode buildTreeRec(int[] inorder, int[] postorder, int s1, int e1, int s2, int e2) {
if(e1 == s1 && s2 == e2) return new TreeNode(inorder[s1]);
if(postorder[e2] == inorder[s1]){
TreeNode root = new TreeNode(postorder[e2]);
TreeNode right = buildTreeRec(inorder, postord... |
56b233ab-b72c-4084-875a-82de4479e7b0 | 8 | public void searchTitle(int docId,RandomAccessFile raf,long start,long end,boolean wikiflag, boolean titleflag) {
//System.out.println(docId);
long mid;
String res;
try {
while(start<=end) {
mid=(start+end)/2;
raf.seek(mid);
... |
901acd08-39fa-4d11-95a0-9314cdb49c2c | 4 | public boolean update() {
x += dx;
y += dy;
if (x < -r || x > GamePanel.WIDTH + r || y < -r
|| y > GamePanel.HEIGHT + r) {
return true;
}
return false;
} |
b958a587-2be1-4cd3-a886-3403beff8e27 | 5 | public int popFront() throws InvalidAccessException {
if (this.head != null) {
if (head.getVal() == Integer.MIN_VALUE) {
int value = head.getList().popFront();
if (head.getList().peekFront() == Integer.MIN_VALUE) {
DLNode temp = head;
head = head.getNext();
temp.setNext(null);
if (head... |
0b594a42-bec3-4cb2-b8c6-d951937a6d7a | 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... |
006e7cd6-f38b-4e6b-a457-4d5888703202 | 0 | @RequestMapping("/create")
public String create(User user, Model model) {
user = userRepository.save(user);
model.addAttribute("user", user);
return "users/form";
} |
12c073a7-2ad2-4248-be50-5341daca4974 | 2 | public Object getChild(Object parent, int index) {
if (parent instanceof Page) {
Page p = (Page)parent;
if (index >= p.children.size()) {
int j = index - p.children.size();
return p.names.get(j);
} else {
return p.children.get(i... |
6b5fd887-9063-4aba-a752-2db4687b66a1 | 7 | public ArrayList<ArrayList<Integer>> fourSum(int[] num, int target) {
// Start typing your Java solution below
// DO NOT write main() function
int n = num.length;
Arrays.sort(num);
Set<String> set = new HashSet<String>();
for (int i = 0; i < n - 3; i++) {
for (int j = i + 1; j < n - 2; j++) {
int exp... |
67136010-0381-4958-a2a0-d2896c3df810 | 9 | private void collectData(int team, String date) {
try {
// Name abfragen
String qTeamname = "SELECT name FROM team WHERE id = " + team + ";";
String teamname = this.dbService.execScrollableQuery(qTeamname);
//System.out.println(teamname);
arffWriter.ad... |
7c0b3349-5299-4bac-b513-4d34b70f0513 | 4 | public void replaySources() {
Set<String> keys = sourceMap.keySet();
Iterator<String> iter = keys.iterator();
String sourcename;
Source source;
// loop through and cleanup all the sources:
while (iter.hasNext()) {
sourcename = iter.next();
source = sourceMap.get(sourcename);
if (source != null) {
... |
dda464fa-82d5-481d-b90b-bb3d7fc25c73 | 8 | public void hand(Point point){
if(selectedShape != null && (selectedShape.contains(point) || isResizing)){
isResizing = true;
if(selectedTool == Tool.MOVE)
moveShape(point);
else
resizeShape(point);
}
else {
boolean found = false;
for(int i = shapesList.size()-1; i >= 0 && !found; i--){
... |
0dbf9838-f132-450a-baa6-b5957302b17f | 3 | public void setColcheteE(TColcheteE node)
{
if(this._colcheteE_ != null)
{
this._colcheteE_.parent(null);
}
if(node != null)
{
if(node.parent() != null)
{
node.parent().removeChild(node);
}
node.par... |
0e108376-8cab-49ee-8d07-dcde205331fc | 8 | private void runTest(Directory dir) throws Exception {
// Run for ~1 seconds
final long stopTime = System.currentTimeMillis() + 1000;
SnapshotDeletionPolicy dp = new SnapshotDeletionPolicy(new KeepOnlyLastCommitDeletionPolicy());
final IndexWriter writer = new IndexWriter(dir, new StandardAnalyzer(org.... |
c31c62f5-8667-4c97-967f-d3617758b7aa | 3 | public ArrayList<String> parseTemplate(ArrayList<ArrayList<String>> data){
int position;
ArrayList<String> newTemplate = new ArrayList<String>();
for(String line : template){
for(ArrayList<String> container : data){
position = line.indexOf(container.get(0));
if(position != -1){
line = line.substri... |
49eb1181-4b38-4cb8-a3ed-6905ca82b683 | 2 | public void addRow(Object[] array) {
//data[rowIndex][columnIndex] = (String) aValue;
try{
// add row to database
EntityTransaction userTransaction = manager.getTransaction();
userTransaction.begin();
Audience newViewer = audienceService.createviewer((String) array[0], (String) array[1], (String) arr... |
72150d86-b41c-4e73-954f-a1782b0b76b9 | 7 | public void run() {
// get line and buffer from ThreadLocals
SourceDataLine line = (SourceDataLine)localLine.get();
byte[] buffer = (byte[])localBuffer.get();
if (line == null || buffer == null) {
// the line is unavailable
return;
... |
c9e510d5-fa92-4de4-9277-1e6ac5679853 | 8 | public TestDriver(String[] args) {
processProgramParameters(args);
System.out.print("Reading Test Driver data...");
System.out.flush();
if (doSQL)
parameterPool = new SQLParameterPool(new File(resourceDir), seed);
else {
if (updateFile == null)
parameterPool = new LocalSPARQLParameterPool(new File(
... |
2811be50-7bed-49a0-ba9f-fe7f966fdb39 | 0 | public Integer getId() {
return this.id;
} |
f045afa5-99f2-40ed-8398-06130df8de06 | 1 | public static List<Interlocuteur> selectInterlocuteurByIdCommercial(int id) throws SQLException {
String query = null;
List<Interlocuteur> interlocuteur1 = new ArrayList<Interlocuteur>();
ResultSet resultat;
query = "SELECT * from INTERLOCUTEUR where ID_COMMERCIAL = ? order b... |
182106b1-8676-4502-a964-027b55d66277 | 8 | public void onEnable(){
this.saveDefaultConfig();
log = this.getLogger();
Lang = this.getConfig().getString("language");
if (Lang.equals("en")){
chatname = "Game Server";
}else if(Lang.equals("ja")){
chatname = "ゲームサーバー";
}else{
log.info("[WARNING]" + Lang + " is not supported.");
log.info("[WA... |
d9c87d2f-158b-43c8-ac0b-de3d7ca85296 | 8 | protected void setInstancesFromDBaseQuery() {
try {
if (m_InstanceQuery == null) {
m_InstanceQuery = new InstanceQuery();
}
String dbaseURL = m_InstanceQuery.getDatabaseURL();
String username = m_InstanceQuery.getUsername();
String passwd = m_InstanceQuery.getPassword();
/*dbas... |
4a802476-3330-49f8-9a11-911330e0511e | 7 | public boolean send(Msg msg_, int flags_) {
// Drop the message if required. If we are at the end of the message
// switch back to non-dropping mode.
if (dropping) {
more = msg_.has_more();
dropping = more;
msg_.close ();
return true;
}... |
24a2f766-4f4a-4e8c-a153-7b9522913834 | 3 | private char[] hashPassword(char[] password)
throws CharacterCodingException {
byte[] bytes = null;
char[] result = null;
String charSet = getProperty(PARAM_CHARSET);
bytes = Utility.convertCharArrayToByteArray(password, charSet);
if (md != null) {
synchr... |
02ec9816-69f8-4a27-9703-bdc125652e76 | 4 | public void commonTest() throws IOException {
//Map<String, String> keys = new HashMap();
String requestBody;
HttpResponse execute;
ResponseHandler<String> handler;
String response;
post.setHeader("address", "192.168.50.174");
post.setHeader("port", "8100");
... |
7c5e10eb-dfb5-4ee1-93c1-d33743a9aaa2 | 2 | private static CommandLine getCommandLine(String args[])
{
HelpFormatter formatter = new HelpFormatter();
Options options = getOptions(args);
CommandLineParser parser = new PosixParser();
CommandLine cmd = null;
try
{
cmd = parser.parse(options, args);
}
catch (ParseException e)
{
System.err.pr... |
9752d2de-ee99-4e2c-9756-491a9c25919d | 0 | public static ParticipantList getInstance() {
return participantList;
} |
5b14b6cc-ab47-4772-a73c-37b3711dc8fc | 6 | @Override
public boolean equals(Object obj) {
if(obj instanceof Pair) {
Pair<?, ?> pair = (Pair<?, ?>) obj;
return key.equals(pair.key) && value.equals(pair.value);
}
return super.equals(obj);
} |
ee4628f8-9de4-4ddf-bba2-062181be36e2 | 7 | public void render(float delta, SpriteBatch batch) {
LevelGenerator.getInstance().generateLevel(this);
for(Class cls : renderOrder){
if(cls == Rocket.class) {
for (Entity rocket : levelEntities.get(cls)) {
if (!isBulletInViewPort(rocket)) {
... |
1e276e62-a74a-4f33-895a-eca8e5a30db2 | 3 | public void setAvalie(PExp node)
{
if(this._avalie_ != null)
{
this._avalie_.parent(null);
}
if(node != null)
{
if(node.parent() != null)
{
node.parent().removeChild(node);
}
node.parent(this);
... |
8a81bd15-57a1-443b-8426-689f0ab2a939 | 7 | private PageSpinner createSpinner() {
PageSpinner s = new PageSpinner();
s.setPage(page);
if (uid != null) {
s.setUid(uid);
uid = null;
}
connect(s);
s.setMinimum(minimum);
s.setMaximum(maximum);
if (stepsize != 0) {
s.setStepSize(stepsize);
stepsize = 0;
}
s.setValue(value... |
7a45f8d1-17be-4e8d-814f-347386cfb7ac | 7 | private File getNodeJsExecutableFile()
{
String nodePath = "";
// Loading the properties for the Runnable objects
// Or trying to create them
String nodeExecutablePath = properties.getProperty("nodePath");
File nodeExecutable = null;
if (nodeExecutablePath != null) {... |
a4cd1f51-df81-4b05-abd9-3ce700d1311f | 1 | private void updateFilm(FilmBean film) {
try {
java.sql.Date date = new java.sql.Date(film.getReturnDate().getTime());
String queryString = "update filme set borowerID = ?, returnDate = '?', "
+ "renewal = ? where id = ? ;";;
PreparedStatement statement =... |
271b7274-ac45-41dc-addb-b25c79228499 | 9 | public static boolean extractFromEmulator(CHREditorModel newModelRef, NES nes){
try {
MemoryInterface mem = nes._memoryManager;
// copy the nametable
int len = newModelRef.getCHRModel().nameTableIndexes[0].length;
byte nt[] = new byte[len];
for(int i=0;i<le... |
1a396fa1-873d-46b4-8c20-cfcbf60d36f6 | 3 | @Override
protected void service(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
String tarefa = request.getParameter("tarefa");
if(tarefa == null) throw new IllegalArgumentException("Você esqueceu de passar a tarefa");
try{
String nomeDaClasse = "br.com.alu... |
230bf765-9260-46c3-b760-a4437050a3da | 5 | public String translate(Object o) {
if (o == null) {
return "null";
}
Class objectClass = o.getClass();
if (objectClass.isArray() || o instanceof Object[]) {
return translators.get(Object[].class).translate(o);
} else {
Translator lowestTrans... |
fc7fb386-90d5-4709-9431-96f040d44224 | 3 | private String processInput(String xmlString) {
String requestType;
//parse XML into DOM tree
//getting parsers is longwinded but straightforward
try {
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
DocumentBuilder builder = factory.newDocu... |
23d2bd51-a1a6-4eb3-896b-ac593cb5f97e | 2 | protected void hudAreaText(HUDArea ha, String t) {
if (ha.isInside(registry.getMousePosition()) && !t.isEmpty()) {
registry.setStatusText(t);
}
} |
ce874e00-1448-4e04-ae25-3be4b22ea359 | 0 | @Override
public String toString() {
return "Fossils found!" + super.toString() + " Fossil=" + this.fossil + " SeenFossil=" + this.seenFossil;
} |
6d52e8f5-9950-46e4-b0ea-f84e6594473a | 8 | public static double calcArctg(double argument, double accuracy) {
if (isNaN(argument) || isNaN(accuracy) || isInfinite(accuracy)) {
return NaN;
}
if (isInfinite(argument)) {
return (argument < 0) ? -PI / 2 : PI / 2;
}
if (abs(argument) >= 1) {
return NaN;
}
final double sqrArg = pow(argument, 2)... |
8345e568-9aed-4f15-9be4-5b1990389f28 | 6 | public static void main(final 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:... |
fbc10a62-f88c-4f33-b509-09e47771ede4 | 4 | public void draw(Graphics g){
int x = getX();
int y = getY();
int w = getW();
int h = getH();
if(w < 0){
x +=w;
w *= -1;
}
if(h < 0){
y +=h;
h *= -1;
}
Graphics2D g2 = (Graphics2D) g;
if(getLinePattern())
g2.setStroke(new MyDashStroke(getLineWidth()));
else
g2.setStroke(new B... |
9c5002f0-8f3d-4620-b1a4-ce96f14f4555 | 6 | * @param winner The <code>Unit</code> that looting.
* @param loserId The id of the <code>Unit</code> that is looted.
* @param loot The <code>Goods</code> to loot.
* @return An <code>Element</code> encapsulating this action.
*/
public Element lootCargo(ServerPlayer serverPlayer, Unit winner,
... |
c038e6cb-8396-4012-89df-b26701c10aa3 | 0 | public boolean getFocused() {
return focused;
} |
ef6fe195-8736-4f1a-84ad-1e483a9b1d3e | 1 | public synchronized boolean remover(int i)
{
try
{
new PesquisadorDAO().remover(list.get(i));
list = new PesquisadorDAO().listar("");
preencherTabela();
}
catch (Exception e)
{
return false;
}
return true;
} |
e16d4670-89e9-4d54-bed1-d3002d5c7f1a | 4 | static double[][] minor(double[][] A, int i, int j){
double[][] minor = new double[A.length-1][A.length-1];
int n = 0, m = 0;
for(int k = 0; k < A.length; k++){
if(k == i)
continue;
for(int l = 0; l < A.length; l++){
if(l == j)
continue;
minor[n][m] = A[k][l];
m++;
}
n++;
m = ... |
c4266c3f-c26b-416f-bedb-ed07e65a0077 | 5 | public Level(){
for(int x=0;x<SIZE;x++){
for(int y=0;y<SIZE;y++){
world[x][y] = TileType.STONE;
}
}
System.out.println("Generating World...");
for(int i=0;i<rand.nextInt(SIZE/2);i++){
generateMineshaft(rand.nextInt(SIZE),rand.nextInt(SI... |
a3bd9915-f22c-4093-b387-f35b36c0df55 | 0 | @Override
public void actionPerformed(ActionEvent e) {
(Outliner.findReplace).show();
} |
4fd79ec1-ade7-436d-987d-d4c210de018d | 0 | public CommandCwreload(CreeperWarningMain plugin) {
this.plugin = plugin;
} |
36dc3f6b-207d-4611-acbd-fdf20e3b6876 | 3 | private Node moveRedRight(Node h) {
assert (h != null);
assert isRed(h) && !isRed(h.right) && !isRed(h.right.left);
flipColors(h);
if (isRed(h.left.left)) {
h = rotateRight(h);
// flipColors(h);
}
return h;
} |
ff1c7ee6-b3a1-4d95-805a-3bc497a178d7 | 1 | public Invoker(Object target)
{
invokeTarget = target;
targetClass = (invokeTarget instanceof Class) ? (Class) invokeTarget : invokeTarget.getClass();
} |
f4af1479-f07e-4e09-88e1-19a6855449bc | 8 | @Override
public List<Ability> domainAbilities(final MOB M, final int domain)
{
final Vector<Ability> V=new Vector<Ability>(1);
if(M!=null)
{
if(domain>Ability.ALL_ACODES)
{
for(final Enumeration<Ability> a=M.allAbilities();a.hasMoreElements();)
{
final Ability A=a.nextElement();
if((A!=... |
bbe227cd-a8e0-48d7-9399-30c7e5a87e4c | 5 | public void RecibirArchivos() throws IOException{
int FILE_SIZE = 6022386;
int bytesRead;
int current = 0;
FileOutputStream fos = null;
BufferedOutputStream bos = null;
Socket sock = null;
try {
sock = new Socket("localhost", 13267);
System.out.pri... |
b612267c-c843-4ec7-9733-656faf251419 | 6 | private Status.StoredFieldStatus testStoredFields(SegmentInfo info, SegmentReader reader, NumberFormat format) {
final Status.StoredFieldStatus status = new Status.StoredFieldStatus();
try {
if (infoStream != null) {
infoStream.print(" test: stored fields.......");
}
// Scan store... |
e7af2946-cd48-4270-b24a-d9275e5b241d | 3 | public static int rowMaxElem(double[][] a, int k) {
int max = k;
for (int i = k + 1; i < a.length; i++) {
if (Math.abs(a[i][k]) > Math.abs(a[max][k]))
max = i;
}
if (a[max][k] == 0)
return -1;
return max;
} |
1a26d610-55bb-44ca-b9d3-16c029f4df15 | 4 | private void btnSelecionaBancoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnSelecionaBancoActionPerformed
JFileChooser flc = new JFileChooser();
flc.setMultiSelectionEnabled(false);
flc.setFileFilter(new FileNameExtensionFilter("Banco de Dados \".gdb\" e \".fdb\"", new St... |
b94f8b2f-6c38-470c-9192-efeb3d753775 | 0 | public int[] getPoints(){
return points;
} |
09c438d5-98c4-44ee-af65-456bac826411 | 7 | @Override
public boolean onCommand(CommandSender cs, Command cmd, String string,
String[] args) {
if (string.equalsIgnoreCase("SetLeapStick")) {
if (cs.isOp() || cs.hasPermission("explosionman.SetLeapStick")) {
if (args.length == 0) {
cs.sendMessage(ChatColor.RED + "The proper usage is "
+ Chat... |
ccf11989-d3ce-41b4-ba3a-c1a45743b6c3 | 0 | @Override
public Object call() throws Exception {
Thread.sleep(5000);
totalMoney = new Integer(new Random().nextInt(10000));
System.out.println("您当前有" + totalMoney + "在您的私有账户中");
return totalMoney;
} |
f528e414-d691-43a5-bf75-ac8acc4d5a6d | 9 | private ActionListener research (final int i) {
return new ActionListener() {
public void actionPerformed (ActionEvent e) {
if (researchupgrading.length() != 0) {
JOptionPane.showMessageDialog(null, "You can only research one research at a time", "ERROR", JOptionPane.ERROR_MESSAGE);
return;
}
... |
e46330b9-6f46-4db3-b841-3a978937cdd7 | 0 | @Override
public void documentAdded(DocumentRepositoryEvent e) {} |
56f33379-0f8d-47c6-8d15-110ec8ffb3d2 | 5 | public static String getURL(Object object) {
String url = (String) HELP_MAP.get(object);
if (url != null)
return url;
Class c = object instanceof Class ? (Class) object : object.getClass();
while (c != null) {
url = (String) HELP_MAP.get(c);
if (url != null)
return url;
url = "/DOCS/" + c.getNam... |
616d2a48-1d41-4be3-ad0e-9f32ba240d6f | 6 | public void pokazPracownikow() {
try {
ResultSet lista = zapytanie.executeQuery("SELECT * FROM pracownicy");
while (lista.next()) {
System.out.println(LINIA);
System.out.println("Id : " + lista.getInt("id_pracownika"));
System... |
ade9bd74-c62b-4cd0-9e79-9521180ed5c4 | 8 | public boolean equals(Object p_other) {
boolean l_bRetVal = false;
if ( p_other == null ) {
l_bRetVal = false;
}
else if ( this == p_other ) {
l_bRetVal = true;
}
else {
ExecutionFilter l_theOther = (ExecutionFilter)p_other;
l_bR... |
a6ba20d2-6922-40c0-b573-0674f3b1fb55 | 4 | public static void filledRectangle(double x, double y, double halfWidth, double halfHeight) {
if (halfWidth < 0) throw new RuntimeException("half width can't be negative");
if (halfHeight < 0) throw new RuntimeException("half height can't be negative");
double xs = scaleX(x);
double ys ... |
884ca57f-f864-4b5d-8aaf-f8cef786220e | 7 | public String getCommand(int x) {
String y;
if (x == 1) {
y = "attack";
}
else if (x == 2) {
y = "defend";
}
else if (x == 3) {
y = "cure";
}
else if (x == 4) {
y = "protect";
}
else if (x == 5) {
y = "reflect";
}
else if (x == 6) {
y = "rise";
}
else if (x == 7) {
y = "... |
7f08a3ce-76f8-4d8a-b3f1-0a0b5ab64fea | 9 | public static void main(String[] args) throws Exception {
if (args.length == 0) {
System.out.println("Please provide a Bronto API token.");
System.exit(0);
}
String token = args[0];
BrontoApiAsync client = new BrontoClientAsync(token, Executors.newCachedThreadPoo... |
5cfe4c89-1f6e-4bd7-9a7b-7b40f8a70343 | 6 | public String getLowOrHighDate(String dateone, String datetwo, boolean highestDate) {
try {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
Date date1 = sdf.parse(dateone);
Date date2 = sdf.parse(datetwo);
if (date1.compareTo(date2) > 0) {
if (!highestDate) {
return datetwo;
} el... |
b32b713c-fe59-4d7f-b5f4-d06a640d1984 | 7 | public int sumNumbers(TreeNode root) {
int sum = 0;
if (root == null)
return sum;
Stack<TreeNode> sta = new Stack<TreeNode>();
// sta.push(root);
TreeNode p = root;
while (p != null || !sta.empty()) {
while (p != null) {
sta.push(p);
p = p.left;
}
if (!sta.empty()) {
p = sta.pop();
... |
00c06357-4c7e-4db1-99fb-b0434059acff | 2 | public void actionPerformed(ActionEvent e)
{
if(e.getSource()==start)
{
stopflag=false;
t=new Thread(this);
t.start();
}
else if(e.getSource()==stop)
{
stopflag=true;
t=null;
}
} |
5bc43e9a-0889-4094-a58a-51b92cfd574c | 2 | public Bee(String name, Block[] rects, float x, float y) {
this.beename = name;
this.x = x;
this.y = y;
map = rects;
try {
bsprite = new SpriteSheet("src/Assets/beesheet.png", 128, 128);
} catch (SlickException e) {
e.printStackTrace();
}
try {
bsprite2 = new SpriteSheet("src/Assets/beeshee... |
f2afc60c-a529-4f04-93fd-48b9bf278f23 | 1 | private Formatter initializeFormatter() {
Formatter formatter;
String format = this.configuration.getMessageFormat();
String separator = this.configuration.getMessageSeparator();
if (separator != null) {
formatter = new SimpleFormatter(format, DISTANCE_CALLER_GIVE_FORMAT, separator);
} else {
formatter ... |
e375d1f4-6108-48a3-9c03-23c8baa2eea4 | 6 | public void clear( final long fromIndex, final long toIndex )
{
if ( fromIndex >= toIndex ) return;
final long fromPos = getSetIndex( fromIndex );
final long toPos = getSetIndex( toIndex );
//remove all maps in the middle
for ( long i = fromPos + 1; i < toPos; ++i )
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.