method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
7dbf2b74-f282-43a6-b069-9ff8139b6b53 | 8 | public Object nextValue() throws JSONException {
char c = nextClean();
String s;
switch (c) {
case '"':
case '\'':
return nextString(c);
case '{':
back();
return new JSONObject(this);
case '[':
... |
6316b228-608e-476e-bac8-59b4066505c4 | 9 | @Override
public boolean tick(Tickable ticking, int tickID)
{
if((tickID==Tickable.TICKID_TRAP_RESET)&&(getReset()>0))
{
if((sprung)
&&(affected!=null)
&&(affected instanceof Room)
&&(!disabled())
&&(tickDown>=0))
{
final Room R=(Room)affected;
if(tickDown>13)
{
R.showHappens(CM... |
47dcfc3e-3e01-4de2-9083-3f519d18cc67 | 1 | public static void triggerAR(String pin)
{
try
{
URL url;
HttpURLConnection connection = null;
String lResponseMessage = "";
String targetURL = "http://staging.webchat.a-cti.com:8082/js/action/eventToTalkAction.do?";
String urlParameters = "method=sendJSONRequest&open=submitClickToTalkForm&formN... |
d42d71a3-370e-4622-a831-9e318671402c | 7 | private BufferedImage createImage() {
final int boldWidth = 3;
final int sudoHeight = 9 * cellHeight + 2 * yOffset + boldWidth;
final int sudoWidth = 9 * cellWidth + 2 * xOffset + boldWidth;
final EmptyImageBuilder builder = new EmptyImageBuilder(sudoWidth, sudoHeight + textTotalHeight, Color.WHITE);
final B... |
fc5840f3-e023-47b9-bebf-44974b6f329e | 9 | private static int editDistanceTranspose(CharSequence cSeq1,
CharSequence cSeq2) {
// cSeq1.length >= cSeq2.length > 1
int xsLength = cSeq1.length() + 1; // > ysLength
int ysLength = cSeq2.length() + 1; // > 2
int[] twoLastSlice = new int[ys... |
f41554d5-8575-469e-b62e-dff170786637 | 8 | private int select(int[] data, int start, int end, int k) {
if (start == end) {
return data[k-1];
}
int t = data[start], i = start, j = end + 1;
while (true) {
do {
i++;
} while (i <= end && data[i] < t);
do {
... |
be723832-67ad-4d1c-9cc3-9f1922517e2f | 3 | public static void cmd()
{
StringBuilder sb = new StringBuilder();
int c;
System.out.print("SimPL> ");
while(true)
{
try {
c = System.in.read();
if(c=='$')
{
System.out.print("SimPL> ");
System.out.println(run(sb.toString()));
System.out.print("SimPL> ");
sb = new String... |
ba9134bd-7c42-4fd8-a6dd-cf45dee67a85 | 3 | private void printItem(String itemName){
Item i = null;
if (((i = bag.getItem(itemName)) != null) || ((i = rooms.get(currentRoom).getItem(itemName)) != null)){
try {
i.printImage();
} catch (FileNotFoundException e) {
System.out.println("Couldn't s... |
2e37aea4-4dbd-4dab-a950-41f35ab22558 | 6 | public void run() {
// watch dir
try {
watcher = FileSystems.getDefault().newWatchService();
textsPath = FileSystems.getDefault().getPath(Core.textsDir);
key = textsPath.register(watcher, ENTRY_CREATE, ENTRY_MODIFY);
} catch (IOException e) {
e.pri... |
d3a1d006-2200-4ccd-a298-3044a57087b2 | 7 | public DirectoryTreePanel() {
initDirectoryTree();
/*stop processing the tree if running in applet mode*/
//if(appletCheck())
// return;
initComponents();
jList1.validate();
/*expand th... |
52e7e27a-c3a1-43c0-9097-5ce2bf133e89 | 7 | @Override
public void unInvoke()
{
// undo the affects of this spell
if(!(affected instanceof MOB))
return;
final MOB mob=(MOB)affected;
super.unInvoke();
if(canBeUninvoked())
{
if((!mob.amDead())&&(CMLib.flags().isInTheGame(mob,false)))
{
if(mob==invoker)
{
if(mob.location()!=null... |
eb4070b2-44b9-4001-b580-9ef75bdc65b1 | 3 | public String setNick(String nickname) {
if (nickname.length() == 0 || nickname.equals(user.getUsername()))
return null;
if (nickname.length() > 20)
return String.format("Invalid nickname: \"%s\"", nickname);
nickname = nickname.replaceAll("\\s", "_");
getUser().setDisplayName(nickname);
return String.f... |
477af76d-8702-4584-9d08-f06a7a37c0c3 | 5 | @POST
@Timed
@Path("getUserDetails")
@Consumes("application/x-www-form-urlencoded")
@Produces({"application/json"})
public Response verifyUserToken(@HeaderParam("serviceId") @NotNull String serviceToken, @HeaderParam("userSessionId") @NotNull String token) {
String errorMessage = null;
... |
aff55371-e810-446d-8276-e97b47f0854b | 3 | private String classSignature() throws UnexpectedTokenException
{
StringBuilder signature = new StringBuilder();
this.expect(PLUS, MINUS, TILDE);
signature.append(this.getToken().data);
this.nextToken();
this.expect(CLASS, INTERFACE, ENUM);
signature.append(this.getToken().data);
this.nextToken();
this... |
796bca7d-6159-480f-970d-3d04d78e9562 | 4 | public void addSorted(PriorityPair pNew){
ListElement el = head;
if(el == null){
addFirst(pNew);
return;
}
else if (pNew.compareTo((PriorityPair)head.first())>0) {
addFirst(pNew);
}
else {
while(el.rest()!=null && pNew.compareTo((PriorityPair)el.rest().first())<=0){
el = el.rest()... |
6f3b7826-6bde-408b-852a-55c3180a473f | 5 | @Override
public boolean equals(Object object) {
// TODO: Warning - this method won't work in the case the id fields are not set
if (!(object instanceof SaleItem)) {
return false;
}
SaleItem other = (SaleItem) object;
if ((this.id == null && other.id != null) || (... |
803498cf-9c67-4768-b843-e6abb87f0cc0 | 1 | private void downloadVersionTable() {
FileRequest mainRequest = requester.request(255, 255);
while (!mainRequest.isComplete()) {
requester.process();
}
versionTable = new ReferenceTable(mainRequest.getBuffer());
} |
1991d810-f4f6-4bdb-84c7-1c1c97621b71 | 7 | @Override
public void onKeyPress(KeyEvent e) {
int key = e.getKeyCode();
if(key == KeyEvent.VK_ESCAPE){
GameMain.game.exit();
}
if(key == KeyEvent.VK_ENTER || key == KeyEvent.VK_SPACE){
if(currentSelection == 0){
setCurrentState(new PlayState(... |
e3118e9a-f0fb-4fce-b582-9dec087bbf0f | 1 | @Override
public boolean equals(Object other){
if (other instanceof Host){
Host o = (Host)other;
return this.hostName.equals(o.getHostName());
}
return false;
} |
00b2bae2-68a5-46b1-960a-5f3232adb3cb | 6 | public final boolean isPoison() {
switch (sourceid) {
case 2111003:
case 2101005:
case 2111006:
case 2121003:
case 2221003:
case 12111005: // Flame gear
return skill;
}
return false;
} |
1f2e01c8-6b78-4975-b462-e22d7f253efd | 7 | public ArrayList<Integer> suffixTreeSearch(String pattern)
{
ArrayList<Integer> resultList = new ArrayList<Integer>();
boolean found = true;
TreeNode currentNode=root;
while(pattern.length()>0 && found)
{
if(currentNode.getChildHash().get(pattern.charAt(0))!=null)
{
Tree... |
8033b921-16e0-4525-83e4-dc0aa63ad65d | 6 | private boolean is_assigned(CPA cpa) throws Exception {
boolean assignmets_constraied=false;
int k=-1;
for(int i=0 ; i<Domain.length ; i++){
k++;
k = find_next_possible_assignment(k);
if(k == -1){
emptyDomain();
return false;
}
Assignment assignment = new Assignment(ID , k);
for(int j=0 ... |
d1423fc6-b848-441f-b8d2-fe62ef467bc1 | 1 | public void restoreHealth(int value){
health += value;
if(health > maxHealth) health = maxHealth;
} |
c3ff91d8-c3ea-45c8-bc14-4a0fdfc195ae | 1 | public static boolean GetKeyUp(int keyCode)
{
return !GetKey(keyCode) && m_lastKeys[keyCode];
} |
63effb0b-0903-40d6-a599-1989efaa81df | 9 | void breakWall(Coordinates actual, Coordinates target) {
try {
//Porte du haut
if ((target.getX() == actual.getX()) && (target.getY() <= actual.getY())) {
caseArray[actual.getX()][actual.getY()].breakTopWall();
caseArray[target.getX()][target.getY()].break... |
52c95605-9bb7-43c8-b601-e0019d9da943 | 8 | public final ArrayList<Instruction> compileMacros(int offest){
ArrayList<Instruction> program = new ArrayList<>();
ArrayList<InputPin> inPins = new ArrayList<>();
ArrayList<OutputPin> outPins = new ArrayList<>();
macroSize = 0;
for (AbstractUnit unit : units) {
if(uni... |
7aa69f11-d936-4c53-93e0-8d619d269c85 | 9 | protected void FillBuff() throws java.io.IOException
{
if (maxNextCharInd == available)
{
if (available == bufsize)
{
if (tokenBegin > 2048)
{
bufpos = maxNextCharInd = 0;
available = tokenBegin;
}
else if (tokenBegin < ... |
8c4be75c-29cd-4b9c-927f-cd78e36e7d52 | 4 | @Override
public boolean equals(Object other) {
if (other == this) { return true; }
if (!(other instanceof GeoPoint)) { return false; }
GeoPoint d = (GeoPoint) other;
return this.referenceEllipsoid.equals(d.referenceEllipsoid)
&& this.latitude.equals(d.latitude) && this.longitude.equals(d.longitude);
} |
a634b1b8-09ba-4fab-bb3b-24acc3663e6e | 6 | private void lu_solve(double a[][], int n, int ipvt[], double b[]) {
int i;
// find first nonzero b element
for (i = 0; i != n; i++) {
int row = ipvt[i];
double swap = b[row];
b[row] = b[i];
b[i] = swap;
if (swap != 0) {
... |
6e20641a-9258-4f21-8d04-f069b59e9f5d | 8 | private void menuSetDifficulty(int difficultyLevel) {
switch(difficultyLevel) {
case DifficultyLevel.EASY:
this.difficultyLevel = new DifficultyLevel(DifficultyLevel.EASY);
break;
case DifficultyLevel.MEDIUM:
this.difficultyLevel = new DifficultyLevel(DifficultyLevel.MEDIUM);
break;
case DifficultyL... |
fb1405ec-992a-4258-bafa-6e6ae7c893f9 | 2 | private OBJIndex parseOBJIndex(String token)
{
String[] values = token.split("/");
OBJIndex result = new OBJIndex();
result.vertexIndex = Integer.parseInt(values[0]) - 1;
if(values.length > 1)
{
hasTexCoords = true;
result.texCoordIndex = Integer.par... |
9ccd1921-9d90-42cd-8af2-1cde934e1958 | 6 | @Override
public void tick(final EntityHandler caller) {
super.tick(caller);
double dx = Math.sin(rotationAngle) * speed;
double dy = -Math.cos(rotationAngle) * speed;
if (rotationAngle > 2 * Math.PI)
rotationAngle -= 2 * Math.PI;
if (rotationAngle < 0)
rotationAngle += 2 * Math.PI;
dir.x = dx;
... |
0ed5efac-49b4-4160-b956-2cfdc6f425f2 | 8 | public double[][] createLattice(int rows, int cols, double rate,
double up, double down, double q)
{
double[][] lattice = new double[rows][cols];
for(int row = 0; row < rows; ++row)
{
for(int col = 0; col < cols; ++col)
{
/*
... |
1c379534-5739-4e50-8689-3f8f671a9a62 | 8 | private static boolean isUnimportantSpot(BotState state, Region region,
List<RegionAnnotations> regionAnnotationsSoFar) {
if (regionAnnotationsSoFar.contains(RegionAnnotations.ENTRANCE_TO_OWN_SUPERREGION)) {
return false;
}
if (regionAnnotationsSoFar.contains(RegionAnnotations.ENTRANCE_TO_OPPONENT_SUPERREGI... |
a0090195-1d72-462c-bec5-4eeedff88e69 | 3 | protected boolean isElementoEnHechosInferidos(String elemento) {
if (null != hechosInferidos) {
for (String s : hechosInferidos) {
if (elemento.equals(s)) {
return true;
}
}
}
return false;
} |
5d6a8d0d-ec99-4316-bb1c-31909ee1fce8 | 6 | public void dbData(String uName) {
try {
Class.forName("com.mysql.jdbc.Driver");
} catch (ClassNotFoundException e) {
System.out.println("Where is your MySQL JDBC Driver?");
e.printStackTrace();
}
if (uName != null) {
PreparedStatement ps ... |
0f918523-b01d-404a-9f90-dd64db73fc41 | 0 | public void setY(byte[] value) {
this.y = value;
} |
f78b9e4c-d006-466f-872f-d29488a8fd36 | 0 | public boolean GetVerbose()
{
return verbose;
} |
3f60dabd-cd96-4d96-b151-4c3419008d3b | 8 | public void move(int x, int y){
canAct = false;
//Check for Map Collision
if(map.tileExists(x, y)){
if(map.tileWalkable(x, y)){
if(!getEm().isCreatureAt(this, x,y)){
this.x = x;
this.y = y;
}else if(getEm().isCreatureAt(this, x,y)){
if(getEm().getEntityAt(this, x, y) instanceof Creature ... |
db260c5d-ac1f-4a85-9a7b-137e0e4654ea | 7 | public QueryHandler(SystemObject querySender, short simulationVariant, ConfigSimulationObject simulationObject) {
_querySender = querySender;
_isRequestFromApplication = _querySender instanceof ClientApplication;
_debug.fine("QueryHandler für " + _querySender + ", isRequestFromApplication: " + _isRequestFromAp... |
31224c0b-da71-49b9-8a76-a1ce3c7b6391 | 1 | public XPathHelper(Node node)
{
_node = node;
try
{
_xpath = newFactory().newXPath();
}
catch(XPathFactoryConfigurationException xpfce)
{
throw new RuntimeException(xpfce);
}
} |
7fc04a98-a0a5-4a89-965a-0906a0f2202a | 5 | public GenericObject loadFromString(String string) {
final long startTime = System.nanoTime();
//notify about loading
assert debug("Loading from string.", 2);
openStringStream(string);
GenericObject root = null;
try {
root =... |
2ec2f728-7941-4d19-b39c-5c0c331d2cd1 | 6 | @Override
public void getDataAttdReport(ClassInfo currentCourse, List<AttdCnt> acList) {
if (acList == null) {
return;
}
acList.clear();
//directory
String crsDirName = getDirName(currentCourse);
File dir = new File(crsDirName);
if (dir.exists() && dir.isDirectory()) {
//read every file in the ... |
5f6611f7-e6f1-4654-97fb-30b0aa0e99e4 | 2 | public String remover(){
for(int i=0;i<repositorio.atividades.size();i++){
if(atividadeaux.getCodigoatividade() == repositorio.atividades.get(i).getCodigoatividade()){
repositorio.atividades.remove(i);
}
}
return "/atividade/lista?faces-redirect=true";
} |
48db8871-afa2-4460-92ae-0fa8dc155e6f | 4 | private void tick() {
if (state == STATE.MENU) {
menu.tick();
}
if (state == STATE.GAME) {
handler.tick();
cam.tick(handler.object);
if (eventOn) {
evt.tick(handler.object);
}
ui.tick();
}
if... |
a6764781-4a22-4d85-9edb-4d13fbe440ca | 1 | private static SoftValueRef create(Object key, Object val,
ReferenceQueue q) {
if (val == null)
return null;
else
return new SoftValueRef(key, val, q);
} |
17990fa3-bc40-4dfa-b56a-f05f2d2c92a8 | 3 | public void showProfile() throws ProfileNotSetException {
if (this.getEmail() == "" || this.getPhone() == ""
|| this.getDescription() == "") {
System.out.println("User " + this.getName() + " does not have any info set.");
} else {
System.out.println("User " + this... |
bc62ec94-8b63-4e5a-8140-9e89b1c0b793 | 8 | public void reset() {
{ QueryIterator self = this;
if ((Stella.$TRACED_KEYWORDS$ != null) &&
Stella.$TRACED_KEYWORDS$.membP(Logic.KWD_GOAL_CACHES)) {
System.out.println("------------- RESET -------------");
}
{ ControlFrame initialframe = self.baseControlFrame;
if (init... |
da9c2366-364a-4b11-8482-6d93a4d1e64e | 5 | public static void copyCheck(HashMap<String, Integer> printed,
HashMap<String, Integer> toPrint, File outFile) {
try {
FileWriter fw = new FileWriter(outFile);
for(Map.Entry<String, Integer> pair : toPrint.entrySet()) {
String key = pair.getKey();
Integer val = pair.getValue();
if (key.ma... |
a3e0c686-c53c-4659-bbf3-61a19c8c024d | 5 | private static String getReducerLogUrl(String reduceTaskDetailsJsp, List<String> countersList) {
Document reduceDetails = HtmlFetcher.getHtml(reduceTaskDetailsJsp);
Element tr = null;
for(Element elem : reduceDetails.getElementsByTag("tbody").first()
.children()) {
if(elem.child(2).text().equals("SUCCEEDED... |
4e912a08-b260-4d01-b932-a6f412b4ca2c | 7 | private static String getHexImageFile(HexType hexType)
{
switch (hexType)
{
case WOOD:
return "images/land/forest.gif";
case BRICK:
return "images/land/brick.gif";
case SHEEP:
return "images/land/pasture.gif";
case WHEAT:
return "images/land/wheat.gif";
case ORE:
return "image... |
793a3b87-5ba2-4a98-a4c9-5ecdefec0f3d | 6 | public Key next()
{
count++;
Key keyToReturn = null;
while (currentNode != null && !currentNode.isKey1Visited)
{
nodeStack.push(currentNode);
currentNode = currentNode.left; //We continue going left to reach the smallest key
}
//Now we c... |
74f03c40-08bd-48ac-aa28-a1a6f3e037fe | 1 | public static String[] addStringToArray(String[] array, String str) {
if (SpringObjectUtils.isEmpty(array)) {
return new String[] {str};
}
String[] newArr = new String[array.length + 1];
System.arraycopy(array, 0, newArr, 0, array.length);
newArr[array.length] = str;
return newArr;
} |
6437defe-4bbd-4400-b401-f22759e32279 | 6 | public void body()
{
// wait for a little while for about 3 seconds.
// This to give a time for GridResource entities to register their
// services to GIS (GridInformationService) entity.
super.gridSimHold(3.0);
LinkedList resList = super.getGridResourceList();
// in... |
2a7ed459-1352-4b5c-bbee-73fb34aeab25 | 0 | @XmlTransient
public Collection<Diagnostico> getDiagnosticoCollection() {
return diagnosticoCollection;
} |
59d9e817-e7bd-40e1-8fb1-7fbed068116f | 1 | @Test
public void shouldThrowErrorWhenFileIsEmpty() throws IOException {
//given
File tmpFile = folder.newFile(FILENAME);
String filePathString = tmpFile.getAbsolutePath();
//when
try {
FileParser fileParser = new FileParser(filePathString);
fileParser... |
524f4cce-b4e3-438a-a3d7-7c1275aeb589 | 0 | public void stop() {
_motor.set(0);
} |
0aa3c555-4fb2-4273-aae9-24e56dbdde95 | 1 | public static BasicToolbox getInstance() {
if (instance_ == null) instance_ = new BasicToolbox();
return instance_;
} |
2cee5c43-fa77-4396-bc76-78413385fbda | 5 | @Override
public void run() {
long previousTime = System.currentTimeMillis();
long currentTime = previousTime;
if (soundSystem == null) {
errorMessage("SoundSystem was null in method run().", 0);
cleanup();
return;
}
// Start out asleep:
snooze(3600000);
while (!dying()) {
// Perform user-... |
b77602fc-b353-40b6-9bb0-adc8af6388c4 | 7 | public Node ceiling(int x){
Node cur = root;
while(true){
if(cur.value==x) return cur;
if(x<cur.value){
if(cur.left==null){
return cur;
}
cur = cur.left;
} else{
... |
028221f1-677e-4668-baf7-b520bb5dabc1 | 4 | public void paint(Graphics g) {
super.paint(g);
/*
*store information about current hour, minute and second.
*/
Date myDate = new Date();
currentHour = myDate.getHours();
currentMinute = myDate.getMinutes();
currentSecond = myDate.getSeconds();
... |
41e3ebf7-ee2f-49d3-b709-3e7c17e24b39 | 7 | private void addVarOp(int op, int varIndex)
{
switch (op) {
case Token.SETCONSTVAR:
if (varIndex < 128) {
addIcode(Icode_SETCONSTVAR1);
addUint8(varIndex);
return;
}
addIndexOp(Icode_SETCONSTVAR, varIndex);
... |
6ccbe177-81c3-469c-9b56-0421bbc1e6d4 | 5 | private void setInitVar(MFStructOrig mforig, InfoSchema info)
{
lstVFVar = new ArrayList<Pair<String, String>>();
for(int i = 0; i != mforig.lst_FV.size(); i ++)
{
int i0 = 0;
if(Character.isDigit(mforig.lst_FV.get(i).charAt(0)))
{
String tmp = mforig.lst_FV.get(i);
for(int j = tmp.length(); j !... |
98fe3241-2d41-4b9d-b2a4-4a12670f4de8 | 5 | public static void main(String[] args) {
Scanner s = new Scanner(System.in);
int numberToGuess = (int)Math.abs(1000 * Math.random());
int guessNumber;
int guesses = 1;
boolean guessed = false;
System.out.print("Try to guess my number (int... |
ab112df3-a0a1-4374-abb6-fe9420f1c1ec | 0 | public EntityListener getEntityListener() {
return entityListener;
} |
72a6ec26-c8f0-46a8-b57f-f286e23422ce | 5 | public void paintComponent(Graphics page) {
//page.drawRect(0,0,50,50);
for (int y1=0;y1<w.HEIGHT;y1++)
for (int x1=0;x1<w.WIDTH;x1++) {
if (w.map[x1][y1].z<=w.WATERLEVEL)
page.setColor(new Color(0,0,64+DELTA*w.map[x1][y1].z));
else if (w.map[x1][y1].river!=-1)
page.setColor(new Color(0,0,Math.... |
a380a371-afc1-4aaa-b379-f48d9181c595 | 7 | static private final void step6()
{ j = k;
if (b[k] == 'e')
{ int a = m();
if (a > 1 || a == 1 && !cvc(k-1)) k--;
}
if (b[k] == 'l' && doublec(k) && m() > 1) k--;
} |
a36d276f-093d-45fc-b37c-356acdf4dd18 | 9 | /* */ public void paint(Graphics g2) {
/* 153 */ if (this.applet != null) return;
/* */
/* 155 */ int w = getWidth() / 2;
/* 156 */ int h = getHeight() / 2;
/* 157 */ if ((this.img == null) || (this.img.getWidth() != w) || (this.img.getHeight() != h)) {
/* 158 */ this.img = createVolati... |
6fe5569b-2d01-49f8-83c6-2bf2dff77708 | 5 | @AfterGroups("Insertion")
@Test(groups = "Red Black Tree")
public void testRedBlackTreeSearch() throws KeyNotFoundException,
EmptyCollectionException {
Integer count;
Reporter.log("[ ** 2-3 Tree Search ** ]\n");
try {
timeKeeper = System.currentTimeMillis();
for (Integer i = 0; i < seed; i++) {
... |
eba2a976-eb9b-47c2-a7e3-060073040302 | 7 | private void advance() throws IOException {
next = null;
while((next==null)&&(reader!=null)) {
final String line = getLine();
if(line!=null) {
next = burster.parse(line);
if(next!=null) {
if(next.isEmpty()||((!allowPartials)&&(!burster.haveAllFields(next)))) {
next = null;
}
... |
e45632a3-97aa-42c7-a9f2-d476712ee01b | 4 | public int getNumberOfFilesInDirectory(DirectoryInfo info) {
Iterable<EntityInfo> iterator = null;
try {
iterator = listDirectory(info.getFullPath());
} catch (NotADirectoryException e) {
e.printStackTrace();
return 0;
} catch (PathNotFoundException e) {
e.printStackTrace();
return 0;
} catch (... |
d1d66001-aa48-45aa-bc99-104d77d062f2 | 3 | public boolean jsFunction_waitEndMove(int timeout) {
deprecated();
int curr = 0; if(timeout == 0) timeout = 10000;
while(JSBotUtils.isMoving())
{
if(curr > timeout)
return false;
Sleep(25);
curr += 25;
}
return true;
} |
1c12202c-148c-40a8-8a6f-b56f5338585c | 0 | public UpdateTask(Region[][] array, int hij, int loj, int hii, int loi,
int threshold, boolean irregular) {
this.array = array;
this.hij = hij;
this.loj = loj;
this.hii = hii;
this.loi = loi;
this.t = threshold;
this.irregular = irregular;
} |
07f63fb1-8059-474f-a00f-fb0af03f42cc | 3 | @Override
public void paintComponent(Graphics g) {
super.paintComponent(g);
for(int i = 0; i < width;i++){
for(int j = 0; j < height;j++){
g.drawImage(backTile, i*cellPix, j*cellPix, null);
}
}
for (MapObject obj : objects){
g.drawImage(obj.sprite, obj.x*cellPix, obj.y*cellPix, null);
}
} |
5d30706a-b028-47c6-9e59-42ca270302e8 | 6 | @Override
public Match find(int id) {
Match found = null;
PreparedStatement pst = null;
ResultSet rs = null;
try {
pst=this.connect().prepareStatement("select * from Matches where id= ?");
pst.setInt(1, id);
rs=pst.executeQuery();... |
7bdc88df-0388-4e64-9548-c05be799317d | 3 | public ArrayList<String> load() throws IOException {
ArrayList<String> words = new ArrayList<String>();
File file = new File(FILE_LOCATION);
Reader r = null;
BufferedReader br = null;
try {
r = new FileReader(file);
br = new BufferedReader(r);
String line = br.readLine();
while (line != null) {
... |
0da187d0-c267-428e-90de-dcf572772ba3 | 7 | @Override
public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
if (label.equalsIgnoreCase("ctf")) {
if (sender instanceof Player) {
Player p = (Player) sender;
if (args.length==0) {
p.sendMessage(CTF.TAG_... |
ef598c0f-315f-4a96-9b1e-1bc2a5a89e6e | 6 | public double weightedMean_as_double() {
if (!weightsSupplied) {
System.out.println("weightedMean_as_double: no weights supplied - unweighted mean returned");
return this.mean_as_double();
} else {
boolean holdW = Stat.weightingOptionS;
if (weightingReset) {
if (weightingOptionI) {
Stat.weighti... |
01fa8ab2-7c47-4705-9a22-28f2c71dd0c7 | 4 | @Override
public void mouseReleased(MouseEvent e) {
try {
if (renderingColor.equals(Color.GREEN)) {
System.out.println(
inputImage.getContentOfSelectionAsBlock(
mouseRect.x, mouseRect.y,
mouseRect.height, mouseRect.width));
} else ... |
1801c1fe-4751-445f-9701-751c669c0917 | 7 | private String getChar(int tone) {
String out="";
final String C36A[]={"Q" , "X" , "W" , "V" , "E" , "K" , " " , "B" , "R" , "J" , "<*10>" , "G" , "T" ,"F" , "<fs>" , "M" , "Y" , "C" , "cr" , "Z" , "U" , "L" , "<*22>" , "D" , "I" , "H" , "<ls>" , "S" , "O" , "N" , "<*30>" , "A" , "P" , "<*33>"};
final String F36A... |
09bff0ba-039c-485c-8b2c-20d4abfb9cba | 0 | @Before
public void setUp() {
} |
feee52e5-7f47-46e1-8309-ffb5878e5233 | 5 | public SimulationMenu(final Simulation model, final MainWindow mainWindow) {
super(new BorderLayout());
setOpaque(false);
this.model = model;// Assigns the model that this menu will control.
this.mainWindow = mainWindow;// Assigns the window this is related to.
// Get the reso... |
b496834f-745c-40b0-8148-d6037c5e2e53 | 2 | public void actionPerformed(ActionEvent e) {
if (e.getSource() == Next) {
}
else if (e.getSource() == Previous) {
}
} |
5fa2ba26-12ba-466b-8e18-f97ee7e2bc56 | 0 | private GuiceInjector() {
} |
53d57bad-2874-4ce1-ac95-8fb90899e990 | 5 | @Override
public void mousePresenceAt(double x, double y) {
for (MenuButton but : _buttons) {
if (but.isMouseWithin(x, y)) {
if (_mouseLastAtButton != but) {
if (_mouseLastAtButton != null)
_mouseLastAtButton.actionOnExit();
but.actionOnEnter();
_mouseLastAtButton = but;
}
return;
... |
95e796ef-4640-4ff4-a3a1-0b08125bbede | 3 | public JargonCollection getParentCollection() throws IrodsException {
IRODSFile p;
try {
if (irodsFile.getParent() == null || irodsFile.getParent().isEmpty()) {
return null;
}
p = conn.irodsFileFactory.instanceIRODSFile(irodsFile.getParent());
} catch (JargonException ex) {
throw new IrodsExceptio... |
125ac11b-c5cf-4e3e-af3b-d7a40360e1c1 | 4 | void accPhiStat(_Doc d) {
double prob;
for(int t=0; t<d.getSenetenceSize(); t++) {
_Stn s = d.getSentence(t);
for(_SparseFeature f:s.getFv()) {
int wid = f.getIndex();
double v = f.getValue();//frequency
for(int i=0; i<number_of_topics; i++) {
prob = this.p_dwzpsi[t][i];
for(int... |
a0c6086c-67cf-4ca5-b833-fe42a79079a6 | 8 | public void searchAllClass(HttpServletRequest request)
{
if (bInit)
return;
try
{
// Tools.getClassesFromFileJarFile("jcore.jsonrpc.rpcobj", "/");//
Class[]lst = Tools.getClasses("jcore.jsonrpc.rpcobj");
if(null == lst)return;
String s;
if(Tools.bDebug && 0 == lst.length)System.out.println("没有... |
a19516b0-a515-4d08-a58e-e7e8a4b75056 | 5 | private void ConvertOld() {
final File file = new File(extraauth.getDataFolder().getAbsolutePath()
+ File.separator + "PlayerStatusDB.db");
new File(extraauth.getDataFolder().getAbsolutePath() + File.separator
+ "PlayerStatusDB.db.bak");
playerstatus ps;
int method;
extraauth.Log.log... |
53dcfb27-089b-45e6-8e90-928ccdb40879 | 2 | public static Receipt getById(final String token, final String id) {
JSONArray fetchById = null;
try {
fetchById = fetchById(token, object, id);
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
List<Receipt> formatOutputs = formatOutputs(fetchById);
if (formatOutp... |
0c652c7c-93a2-481d-a649-447b0eba8c70 | 4 | public JSInventory[] getInventories() {
ArrayList<JSInventory> items = new ArrayList<JSInventory>();
try {
for (Widget i = wdg().child; i != null; i = i.next) {
if (i instanceof Inventory) {
items.add(new JSInventory(UI.instance.getId(i)));
}
}
} catch (Exception ex) {
// Do nothing
}
JS... |
d3c357c5-d494-4a8e-b2aa-eb9ce32ef97a | 5 | private void saveLabels() {
// Make sure any labels in the removed blocks are saved.
boolean save = false;
final Iterator iter = method.code().listIterator();
while (iter.hasNext()) {
final Object obj = iter.next();
if (obj instanceof Label) {
final Label label = (Label) obj;
if (label.startsB... |
f71c26c3-3d3f-4ead-a576-65a705961b4f | 2 | private boolean stepInDirectionOfX(int xDestination) {
if (x < xDestination) {
x += Math.min(stepSize, xDestination - x);
} else if (x > xDestination) {
x -= Math.min(x - xDestination, stepSize);
}
return x == xDestination;
} |
234d55b1-da92-43bc-b651-c71d2b3c50b0 | 6 | public static boolean checkIfNoneMatchEtag(HttpServletRequest request, HttpServletResponse response, String etag) {
String headerValue = request.getHeader("If-None-Match");
if (headerValue != null) {
boolean conditionSatisfied = false;
if (!"*".equals(headerValue)) {
StringTokenizer commaTokenizer = new S... |
36cb8330-77a9-44bb-8f95-7c734ad62084 | 5 | public Object getLdcValue(int index) {
ConstInfo constInfo = this.getItem(index);
Object value = null;
if (constInfo instanceof StringInfo)
value = this.getStringInfo(index);
else if (constInfo instanceof FloatInfo)
value = new Float(getFloatInfo(index));
... |
f4570c59-e818-4b72-896a-170fc604102f | 8 | private void growObstaclesPass() {
// grow obstacles
for (int i = 0; i < userObstacles.size(); i++)
((Obstacle) userObstacles.get(i)).growVertices();
// go through paths and test segments
for (int i = 0; i < workingPaths.size(); i++) {
Path path = (Path) workingPaths.get(i);
for (int e = 0; e < path.... |
2222c922-0a60-4b9d-95b2-c903fb865851 | 1 | public void runAnimation(){
index++;
if(index > speed){
index = 0;
nextFrame();
}
} |
c2a44955-6a6f-4b29-933f-ed99b0dff71d | 5 | public boolean searchForElement(String value) {
boolean isFound = false;
ListElement index = head;
if (index != null) {
if (index.next == null && index.value == value) {
isFound = true;
} else {
while (index.next != null) {
... |
27a7d3d1-ef6f-4a26-9b1f-8b0db2e5e7f9 | 5 | public void removeClass(String name){
DragAndDropClassObject obj;
for (int i=0;i<components.size();i++){
obj = components.get(i);
if (obj.name.equals(name)){
for (DragAndDropClassObject classObject:components){
for (int j = 0; j<classObject.links.size(); j++){
Link link = classObject.links.get(... |
f70017dd-1d22-4469-a6bb-913624ceb514 | 3 | public boolean AreXItemsInBag(int ItemID, int Amount) {
int ItemCount = 0;
for (int i = 0; i < playerItems.length; i++) {
if ((playerItems[i] - 1) == ItemID) {
ItemCount++;
}
if (ItemCount == Amount) {
return true;
}
}
return false;
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.