method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
e0e71dcd-d7cd-45c3-83a3-d3e7feaf56dc | 0 | public IconKeyListener() {
super();
} |
2a7063fa-d92c-4aee-b74c-8bea7e692245 | 3 | public boolean hasNext() {
if(map.root == null)
return false;
if(current != null && current.getNext() == null)
return false;
return true;
} |
a801ddee-a131-4105-901f-c289b9a8319c | 8 | @SuppressForbidden(reason = "System.out required: command line tool")
static IndexUpgrader parseArgs(String[] args) throws IOException {
String path = null;
boolean deletePriorCommits = false;
InfoStream out = null;
String dirImpl = null;
int i = 0;
while (i<args.length) {
String arg = a... |
b7601219-9b7e-48a0-8c22-54a9f0f37968 | 8 | public UnconditionalFlowInfo mitigateNullInfoOf(FlowInfo flowInfo) {
if ((this.tagBits & NULL_FLAG_MASK) == 0) {
return flowInfo.unconditionalInits();
}
long m, m1, nm1, m2, nm2, m3, a2, a3, a4, s1, s2, ns2, s3, ns3, s4, ns4;
boolean newCopy = false;
UnconditionalFlowInfo source = flowInfo.unconditionalInits();
... |
0f59094f-f58e-4470-b170-443a0f227bcb | 0 | public static int numberOfFrames() {
return environmentToFrame.size();
} |
2ed9b3c0-4a32-4434-a450-cbe04f82f58a | 8 | @Override
public void onPrivmsg(String connectionName, String host, Message m) {
if(m.getContent().toLowerCase().contains("$"+connection.getNick())) {
String mess = m.getContent();
System.out.println("mess:"+mess);
if(mess.toLowerCase().contains(":")) {
mess = mess.substring(mess.indexOf(" ")+1, mess.le... |
06517164-4764-43a1-97d1-3cb13ba05860 | 9 | public PaintSurface(Canvas paintCanvas, Text statusText, Color fillColor) {
this.paintCanvas = paintCanvas;
this.statusText = statusText;
clearStatus();
/* Set up the drawing surface */
Rectangle displayRect = paintCanvas.getDisplay().getClientArea();
imageWidth = displayRect.width;
imageHeight = display... |
dbe70bb4-fad9-477a-907c-deba74aa209c | 8 | @Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (!(obj instanceof Block))
return false;
Block other = (Block) obj;
if (data == null) {
if (other.data != null)
return false;
} else if (!data.equals(other.data))
return false;
... |
b4d9825a-288b-4dc2-b853-9fd2f99f9c92 | 9 | @SuppressWarnings("unchecked")
private void loadCollection(Object obj, XmlParserContext context, Field field) throws XMLStreamException, IllegalArgumentException, IllegalAccessException, InstantiationException {
Object collection = null;
String marker = getMarker();
String tag;
while ((tag = nextTag(marker)) !... |
e16def61-5582-47f9-9d60-f12f5816a133 | 0 | protected void execute() {
double left = Robot.oi.getLeftDrive(),
right = Robot.oi.getRightDrive();
// SmartDashboard.putNumber("Left", left);
// SmartDashboard.putNumber("Right", right);
Robot.driveTrain.tankDrive(left,right);
} |
535c3340-a0d1-4899-9319-3de455ea3e52 | 7 | public static void main(String[] args) {
try {
if (args.length != 2) {
System.out.println("useage: java -jar TouchToggle.jar server_ip_address server_port");
System.exit(0);
}
Socket sock = new Socket(args[0], Integer.parseInt(args[1]));
... |
6b0df5a7-4a6a-4685-b79f-20e5417682ef | 1 | public RQIterator() {
this.i = next - 1;
this.ar = a;
if (i > 0)
new Shuffle().shuffle(ar, 0, i - 1);
} |
0380d827-a743-4d7a-b0e6-498993b617a8 | 5 | private boolean directLineTo(Graphics2D g, Connector c, Point ep) {
Point p = c.getDirectP();
Point tp;
if (c.isVertical())
tp = new Point(p.x, ep.y);
else
tp = new Point(ep.x, p.y);
if (eFrom.intersects(tp, p) || eTo.intersects(tp, p)
|| eFrom.intersects(tp, ep) || eTo.intersects(tp, ep))
retur... |
fe95b639-e975-4f7f-95a3-89c341f0ac68 | 5 | private void checkInput(long elapsedTime) {
if (exit.isPressed()) {
stop();
}
Player player = (Player)map.getPlayer();
if (player.isAlive()) {
float velocityX = 0;
if (moveLeft.isPressed()) {
velocityX-=player.getMaxSp... |
a4c09e37-cd74-4f79-b698-9fe58c806fd2 | 7 | @Override
public int getxattrsize(String path, String name, FuseSizeSetter sizeSetter)
throws FuseException {
try {
ExtendedAttribute attribute = fileSystem.getExtendedAttribute(path, name);
sizeSetter.setSize(attribute.getContent().length);
return 0;
} catch (PathNotFoundException e) {
return Errno... |
2ece578c-d064-4c79-85ba-b1d24d5c0827 | 3 | public static boolean containsElement(Object[] array, Object element) {
if (array == null) {
return false;
}
for (Object arrayEle : array) {
if (nullSafeEquals(arrayEle, element)) {
return true;
}
}
return false;
} |
8eda0be2-6e92-4e9b-b720-031523e3a3fb | 3 | private Note readNoteFromFile( final long id, final File noteFile ) {
if( !noteFile.exists() || !noteFile.canRead() ) {
return null;
}
BufferedReader r = null;
try {
r = FileHelper.getBufferedUtf8FileReader( noteFile );
return readNoteFromReader( r );
}
catch( final IOException e ) {
throw new... |
d0938b9d-69e5-490d-888d-b615fe932626 | 6 | @Override
public boolean equals(Object obj) {
if (null == obj) {
return false;
}
if (this == obj) {
return true;
}
if (obj instanceof PostParameter) {
PostParameter that = (PostParameter) obj;
if (file != null ? !file.equals... |
51966dc6-4568-4582-a154-bab010f235d3 | 4 | public void drawTrees(Graphics g, Player p){
if(p.getCurrentCity() == 1){
if(p.getInside()){
}else{
int s = p.getCurrentSec()-1;
for(int i = 0; i < 1200; i++){
if(s>5)
g.drawImage(city1Tree[s][i].getImage(), city1Blocks[i].x, city1Blocks[i].y, null);
}
}
}
} |
61d00084-d479-4aa8-85ea-5b9d58bb0f61 | 2 | @Override
public void buildRoad(IPresenter presenter, EdgeLocation roadLocation) {
MoveResponse response = presenter.getProxy().buildRoad(presenter.getPlayerInfo().getIndex(), roadLocation, false, presenter.getCookie());
if(response != null && response.isSuccessful()) {
presenter.updateServerModel(response.getG... |
22502fdb-62ca-483e-ac1e-8bbdb8946b2b | 9 | public final void setPos(int x, int y, boolean teleported) {
if (animation != -1
&& AnimationSequence.animations[animation].precedenceWalking == 1)
animation = -1;
if (!teleported) {
int distanceX = x - waypointX[0];
int distanceY = y - waypointY[0];
if (distanceX >= -8 && distanceX <= 8 && distance... |
3beb64f4-53e0-424a-995a-dcc9c6a54f1c | 4 | @Override
public void execute(CommandSender sender, String Command, List<String> list) {
this.sender = sender;
if (Command.equals("save")) {
this.getConfigHandler().save();
this.reply("Saved the data to config file");
}
if (Command.equals("reload")) {
this.getConfigHandler().load();
this.reply("Fil... |
7e83cbfc-1849-4aba-af23-78555d8761ae | 1 | public void execute() {
for (int i = 0; i < commands.length; i++) {
commands[i].execute();
}
} |
d071f285-b842-48c8-886f-55de054c8241 | 4 | public void addAlerts(Collection<Alerts> newAlerts) {
if (newAlerts == null) {
return;
}
if (alerts == null) {
alerts = new ArrayList<Alerts>(newAlerts);
return;
}
for (Alerts alert : newAlerts) {
if (!alerts.contains(alert)) {
alerts.add(alert);
}
}
} |
4be7827b-6e4b-4cad-936f-42cbaeb53842 | 8 | public static String unorthodoxFrac(int num, int den){
double ans = (double)num/(double)den;
if((double)(num%10)/(double)(den%10)==ans && num/10==den/10) return String.valueOf(num) + " / " + String.valueOf(den);
else if((double)(num%10)/(double)(den/10)==ans && num/10==den%10) return String.valueOf(num) + " / ... |
ab31aaba-764a-4add-ab0e-3a8bea1ff87d | 6 | public static void main(String[] args)
{
Deck deck = new Deck();
Hand ourHands[] = new Hand[5];
for (int i=0; i<5; i++)
{
ourHands[i] = new Hand(deck);
ourHands[i].evaluateHand();
ourHands[i].display(); //show the summary of the hand, e... |
509df0d6-75ae-446e-8c61-f54c6a6269cd | 0 | public String getType(){
return type;
} |
24d8c082-f531-427c-b9e6-869a33055df2 | 4 | private void setUp(Image im, String t) {
setTitle(t);
// Build box buttonBox of buttons.
// First compute largest button size.
int msize = 0;
for (int i=0; i < buttonLabelList.length; i= i+1) {
if (msize < buttonLabelList[i].length()) {
msize = buttonLabelList[i].length();
}
} ... |
ecee68f6-abd2-4302-98b6-408005bdd6f9 | 7 | @Override
public boolean containsKey(Object key) {
if (!(key instanceof Binary))
return false;
final Binary bKey = (Binary) key;
final byte[] keyData = bKey.getValue();
final int keySize = keyData.length;
final int hash = Math.abs(hashFunction.ap... |
ddef09cd-945d-43bc-a549-c73dd2f67d23 | 8 | public void doGet(HttpServletRequest req, HttpServletResponse resp) {
resp.setContentType("text/plain");
String queueName = AnalysisUtility.extractParameterOrThrow(req,
AnalysisConstants.QUEUE_NAME_PARAM);
String bigqueryProjectId = AnalysisUtility.extractParameterOrThrow(req,
AnalysisConstants.BIGQUERY_... |
f967acfb-1558-4ff8-a05b-1015c48c51c8 | 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... |
f8bc7958-eb52-49a3-8974-faae9f6971a8 | 1 | public void setBaseSalary(double salary) {
baseSalary = (salary < 0.0) ? 0.0 : salary;
} |
89600c10-5c52-4449-b103-14be9ffb3a21 | 0 | public Point(double x, double y)
{ this.X = x; this.Y = y; } |
2323031f-7afe-4567-a4f8-f8c6f5967822 | 0 | public Rectangle getRect(){
return new Rectangle(x,y,w,h);
} |
bde7c2b6-c541-4d5a-8749-90c77c16c979 | 9 | public static void SwapPrepareTask(String typeId, String flowID, boolean up, boolean top, boolean bottom) {
TaskInfoStorage tis = ThreadWorkerDispatcher.taskInfoStorageMap.get(typeId);
if (tis != null) {
LinkedHashMap<String, TaskThread> perparing = tis.PREPARING_TASK;
for (Entry<String, TaskThread> taskThrea... |
5151f459-e7e5-4589-86bc-9114e2dc35ba | 1 | public static final int StateUpdateRep(int index)
{
return index < 7 ? 8 : 11;
} |
539b17bc-44cf-4b1e-becc-cc071ef58385 | 1 | private void lazyInstantiation() {
if (isInitialized) {
return;
}
chooser = new OutlinerFileChooser(null);
isInitialized = true;
} |
18eaa950-c2dd-4cba-b410-fc9200093a8a | 3 | public DFA(String pattern, int R) {
this.pattern = pattern;
this.R = R;
int M = pattern.length();
// initialize
dfa = new int[R][];
for (int r = 0; r < R; r++)
dfa[r] = new int[M];
dfa[pattern.charAt(0)][0] = 1;
// build DFA
for (int X = 0, j = 1; j < M; j++) {
// mismatch
for (int c ... |
305171d9-1d0b-4b0e-8825-01b5867c5f85 | 1 | public String toString()
{
String out = "";
for(int i = 0; i < compounds.length; i++)
out += " + "+compounds[i];
out = out.substring(3);
return out;
} |
2d73838b-4b04-4136-bdb5-2d17a89baf41 | 4 | private SplayTreeNode zag(SplayTreeNode node) {
SplayTreeNode k1 = new SplayTreeNode(node.parent);
SplayTreeNode k1Parent = k1.parent;
SplayTreeNode a = new SplayTreeNode(node.parent.left);
if (a.isNull())
a.parent = k1;
SplayTreeNode k2 = new SplayTreeNode(node);
... |
4e83a1bc-7462-4708-b14d-5df92fa1b040 | 4 | @Override
public void actionPerformed(ActionEvent event)
{
JButton source = (JButton) event.getSource();
if(owner != null && source.equals(buttons[0])) // button object for restart
{
owner.restart();
}
else if(ownerGame != null && source.equals(buttons[1]))
{
... |
85d4efbf-6871-4e8a-9558-d73554920a50 | 8 | public void writeEncodedAttribute(String attribute) {
int length = attribute.length();
for (int i = 0; i < length; i++) {
char ch = attribute.charAt(i);
if (ch == '<') {
print(LESS_THAN_ENTITY);
} else if (ch == '>') {
print(GREATER_THAN_ENTITY);
} else if (ch == '&') {
print(AMPERSAND_ENT... |
788ddb3e-2e27-41cc-9833-52d305d01a8a | 5 | public void logout(ServerThread client){
currentClients.remove(client);
boolean userNameStillUsed = false;
for(ServerThread thread : currentClients){
if (thread.getUserName().equals(client.getUserName())){
userNameStillUsed = true;
}
}
//Client was only one using the username
if(!userNameStillUsed... |
6f41dfce-beab-4d68-bb81-c5f8670b00d4 | 3 | public static boolean equals(String s, String s1) {
if (s.length() != s1.length()) {
return false;
}
char c[] = s.toCharArray();
char c1[] = s1.toCharArray();
for (int i = 0; i < s.length(); i++) {
if (c[i] != c1[i]) {
return false;
}
}
return true;
} |
398dd71b-7ad2-40c0-b5ca-5a9b4bacda6c | 1 | public int getShort() { // readSignedWord
offset += 2;
int v = ((payload[offset - 2] & 0xff) << 8) + (payload[offset - 1] & 0xff);
if (v > 32767) {
v -= 0x10000;
}
return v;
} |
3b5156f9-bf96-42d4-9016-5cf52a30e376 | 4 | private void parse(boolean target, boolean debug) throws IOException{
System.out.println("stage: parser");
PrintWriter pw = null;
if (target){
outFile = new File(this.name + ".parse");
outFile.createNewFile();
pw = new PrintWriter(new FileWriter(outFile));
if (debug)
System.out.println("Se creo el... |
0d874ba6-c5a6-4662-8b71-b869d7b2795f | 3 | private void buildTable(String button) {
URL[] urls;
switch (button) {
case "all":
urls = xml.getURLs();
break;
case "page":
urls = xml.getURLsOfType(URLType.Page);
break;
case "document":
... |
4ffd29dc-33e7-4add-aa57-af2dfa41c0fb | 1 | @Override
public void run() {
for (Actor element: myUniverse.getShapeList()) {
element.onTick();
}
} |
1f4a9430-50a6-4636-9bec-59c10d4cf341 | 5 | public static String parseAndRep(String[] args)
{
try
{
String str = args[0];
int iter = Integer.parseInt(args[1]);
if (iter <= 0) throw new NumberFormatException();
String ret = "";
for (int i=0;i<iter;i++)
{
ret += str;
if (i < iter-1) ret += " ... |
54867f75-3418-4a14-91b6-6a8bd7540c34 | 0 | public String logout() {
loginDelegate.logout();
return "/index.xhtml?faces-redirect=true";
} |
00b706c7-fdbd-4a34-860c-9172014e3871 | 5 | public void setNeighbors( int[] truckdrivin){
for(int g = 0; g <= truckdrivin.length-1; g++){
switch(inmode){
case 0: neighborstate[g] = 0; break;
case 1: if(truckdrivin[g] > 0){neighborstate[g] = 1;}
else{neighborstate[g] = 0;} break;
case 2: neighborstate[g] = truckdrivin[g]; break;
default:... |
2f7cec91-4678-43a9-b784-5d7d75b93e71 | 2 | public int getColumnIndex(final String colName) {
int idx = -1;
if (columnIndex != null) {
final Integer i = columnIndex.get(colName);
if (i != null) {
idx = i.intValue();
}
}
return idx;
} |
95c8f4ef-a9c8-4705-b776-50404a6be6af | 3 | public void testCycFormula() {
System.out.println("\n*** testCycFormula ***");
final CycFormulaSentence isaXThing = CycFormulaSentence.makeCycFormulaSentence(ISA, VAR_X, THING);
assertEquals(isaXThing.getFirstArgPositionForTerm(isaXThing), ArgPosition.TOP);
final Set<CycConstant> gatheredConstants = isa... |
59347447-9b4f-4cad-bb26-2ca7f31418a0 | 4 | @Override
public void paintComponent(Graphics g) {
super.paintComponent(g);
Image image = Constanten.MARKERING_PATTERN.getImage();
int iw = image.getWidth(this);
int ih = image.getHeight(this);
if (iw > 0 && ih > 0) {
for (int x = 0; x < getWidth(); x += iw) {
... |
a4da6fb5-1a66-4425-8b4e-fef9a860ccc5 | 4 | public ArrayList ListaKorpi() throws Exception{
ArrayList korpe=new ArrayList();
try{
stmt=con.createStatement();
String query1 = "SELECT * FROM potrosackakorpa WHERE status = "+0;
RS=stmt.executeQuery(query1);
while(RS.next()){
Korp... |
8d10246b-10ed-455f-b166-628e38c44119 | 6 | FetchPoint[] fetch(FetchRequest request) throws IOException, RrdException {
if(request.getFilter() != null) {
throw new RrdException("fetch() method does not support filtered datasources." +
" Use fetchData() to get filtered fetch data.");
}
long arcStep = getArcStep();
long fetchStart = Util.normalize(r... |
d553a996-e7e0-406c-a1bc-da99b17dff78 | 5 | private void pop(char c) throws JSONException {
if (this.top <= 0) {
throw new JSONException("Nesting error.");
}
char m = this.stack[this.top - 1] == null ? 'a' : 'k';
if (m != c) {
throw new JSONException("Nesting error.");
}
this.top -= 1;
... |
8aebcae1-a9f0-444c-8b9b-f64e50ea95d8 | 7 | public void mouseDragged(MouseEvent e) {
Graphics2D g = image.createGraphics();
D.x = e.getX() / (int) scale;
D.y = e.getY() / (int) scale;
T.y = Math.min(D.y, S.y);
T.x = Math.min(D.x, S.x);
// drag = true;
setColor(g, false);
switch (TabbedPanel.TOOL) {
case SELECT:
this.repaint();
... |
72819369-26d9-49b6-a729-8e19b7ed1587 | 5 | public CheckResultMessage check17(int day) {
int r1 = get(33, 5);
int c1 = get(34, 5);
int r2 = get(39, 5);
int c2 = get(40, 5);
BigDecimal b = new BigDecimal(0);
if (checkVersion(file).equals("2003")) {
try {
in = new FileInputStream(file);
hWorkbook = new HSSFWorkbook(in);
b = getValue(r1, ... |
fb97cb3e-7865-4cee-8e0a-e43bce3ce092 | 3 | public Date getMinDate(){
Date ret = null;
for (Integer key: colMinDates.keySet()) {
Date d = colMinDates.get(key);
if (ret == null || ret.after(d)){
ret = d;
}
}
return ret;
} |
d76bfb08-6d0a-4e92-99aa-7658f2f90914 | 3 | @Test
public void testAggregateOnInterface() throws Exception
{
int sum = (200 * 199) / 2;
int min = 0;
int max = 199;
double avg = 199.0 / 2.0;
// create a database connection
PersistenceManager pm = new PersistenceManager(driver, database, login, password);
// drop all tables
pm.dropTable(Object.c... |
fbee8024-ff58-42c4-8158-6fc4cdf08adb | 5 | void shellSort(int factor) {
int j, offset = 1;
boolean exchange;
while (offset <= points.length()-1) {
offset *= factor;
offset--;
}
while (offset > 1) { // offset-reduction-loop
offset++;
offset /= factor; // reduce offset
do {
exchange = false;
for (j = points.length()-1; j > offs... |
5c93b649-388a-4e40-a16b-1dd00d38e4e7 | 7 | private void nextPermutation(Node list, Node permutationStart, Node permutationEnd, PermutationHandler handler) {
if (list == null) {
buildPermutation(permutationStart, handler);
return;
}
Node current = list;
Node previous = null;
Node next = null;
... |
be8b5eb3-a523-4635-b483-ae1d68f790c2 | 3 | public void filterPage(HTMLPage thePage, WebResponse theResult) throws Exception {
String contentAsString = theResult.getContentAsString();
if (!(contentAsString.indexOf("$Id") > -1) &&
!(contentAsString.indexOf("$Source") > -1) &&
!(contentAsString.indexOf("$Version") > -1)) {
throw new RuntimeExceptio... |
364da4a2-3fb5-45fd-9ee2-bb1462e35ee8 | 9 | @Override
public void logic()
{
if(!isAlive())
{
return;
}
Vector dis = getLoc().sub(getCenter());
if(dis.mag() < 200 || (health < 3 && !Frame.easyMode))//chase if close
{
dx += 0.2 * dis.x/dis.mag();
dy += 0.2 * dis.y/dis.mag();
sprite.animation = 1;
}
else
{
if(Math.hypot(dx, dy) =... |
422820b2-7832-465d-b265-fef7baf64245 | 5 | private boolean zzRefill() throws java.io.IOException {
/* first: make room (if you can) */
if (zzStartRead > 0) {
System.arraycopy(zzBuffer, zzStartRead,
zzBuffer, 0,
zzEndRead-zzStartRead);
/* translate stored positions */
zzEndRead-= zzStartRe... |
4f1ae6b6-8758-46e1-81b7-c8c7904c1d8e | 1 | public void test_DateTime_parse_Gaza() {
try {
new DateTime("2007-04-01T00:00", MOCK_GAZA);
fail();
} catch (IllegalInstantException ex) {
assertEquals(true, ex.getMessage().indexOf("Illegal instant due to time zone offset transition") >= 0);
}
} |
50fe5a0b-749e-4292-abe5-01cf95ee4084 | 8 | @Override
/** Handler for mouse releases */
public void mouseReleased(int key, int mx, int my) {
if (!isVisible) return;
if (key == input.MOUSE_LEFT) {
int mouseUpState = getMouseState(mx, my);
if (mouseUpState == mouseDownState){
switch (mouseUpState){
case TOP:
if (currentAircraft.getAlti... |
a1cacbeb-ff17-488b-ae02-972027dfbbf9 | 7 | protected void drawBaseNoShadow(Graphics2D g2d, int x, int y, int colWidth, int row, int site, Sequence seq) {
if (site>=seq.length())
base[0] = ' ';
else
base[0] = seq.at(site);
if (letterMode == NO_LETTERS) {
return;
}
if (letterMode == DIF_LETTERS) {
if (referenceSeq == null)
referenceSe... |
0ab2c427-a40d-4532-b659-1983f16aa051 | 3 | @Override
public void fire() {
if(salud > 0){
int value = Velocidad.MEDIA.VALUE;
if(municion > 0){
disparar(-value,"laserRojo");
}
municion = (municion--<=0)? 0 : municion;
}
} |
635b1e6d-7bff-4b76-bace-fb38b3e00ad9 | 1 | private static URL __getWsdlLocation() {
if (HELLOWWORLDIMPLSERVICE_EXCEPTION!= null) {
throw HELLOWWORLDIMPLSERVICE_EXCEPTION;
}
return HELLOWWORLDIMPLSERVICE_WSDL_LOCATION;
} |
32360ff7-518d-4ec7-93b2-63fb65ba2566 | 2 | public static void main(String[] args) {
// TODO Auto-generated method stub
ArrayList<String[]> str1= new ArrayList<>();
ArrayList<String[]> str= new ArrayList<>();
str=solveNQueens(4);
for(int i=0;i<str.size();i++)
{
for(int j=0;j<str.get(i).length;j++)
System.out.println("Row " + j + ":"+ str.get(i... |
a97f7dfe-0be3-42c4-a452-25f645d9ecfc | 1 | public void disableTag(Tag t){
if(t == null)
this.disableTag.clear();
this.disableTag.add( t );
} |
fae341a5-8515-40b3-a4f4-6ef1d29a1ec0 | 4 | public List<Token> parse(String input) {
List<Token> tokens = new ArrayList<Token>();
if (input == null || input.length() == 0) {
return tokens;
}
char[] array = getArray(input);
int length = array.length;
for (int i = 0; i < length; i++) {
Token token = getToken(array, i, tokens);
if (token != n... |
b4e7190f-b5fc-4b59-b582-ab759a16f0b4 | 7 | public void renderSprite(int xp, int yp, Sprite sprite, boolean fixed){
if(fixed){
xp -= xOffset;
yp -= yOffset;
}
for(int y = 0; y < sprite.getHeight(); y++){
int ya = y + yp;
for(int x = 0; x < sprite.getWidth(); x++){
int xa = x + xp;
if(xa < 0 || xa >= width || ya < 0 || ya >= height) cont... |
beb57c03-a605-496d-a97a-5f311a140645 | 0 | public boolean checkPassword(String passwordClear) {
return BCrypt.checkpw(passwordClear, this.passwordHashed);
} |
9242ae80-2b76-47b4-872a-362393c5a2f4 | 6 | public boolean act( Agent agent, Action action ){
if( energy_level <= 0 ){
agent.die();
updateViews(msg);
return false;
}
boolean flag = (action != null);
if( flag ){
SimulatedAgent a = (SimulatedAgent) agent;
int x = ( (Integer) a.getAttribute(X)).intValue();
int y =... |
c5cbd972-c05d-4820-9941-ab291e947ed3 | 1 | public void visitFlowGraph(final FlowGraph cfg) {
cfg.source().visit(this);
final Iterator e = cfg.trace().iterator();
while (e.hasNext()) {
final Block block = (Block) e.next();
block.visit(this);
}
cfg.sink().visit(this);
this.out.flush();
} |
d8b833a7-596a-4bc6-bf79-8be82b94db7e | 4 | private int jjMoveStringLiteralDfa2_8(long old0, long active0) {
if (((active0 &= old0)) == 0L)
return 2;
try {
curChar = input_stream.readChar();
} catch (java.io.IOException e) {
return 2;
}
switch (curChar) {
case 93:
if ((active0 & 0x1000000L) != 0L)
return jjStopAtPos(2, 24);
break;
... |
532b95ee-edca-4653-a666-58b14de79f50 | 7 | protected SurfaceSelection getNextRootRange(SurfaceSelection selection) {
Node base = selection.getSelection().getRange().getCommonAncestorContainer();
Element ancestor;
if (base.getNodeType() == Node.TEXT_NODE) {
ancestor = base.getParentElement();
} else {
ancestor = (Element) base;
}
if (ancestor ... |
0dd4a86b-17ee-49b3-9cf7-95dddd9dd428 | 6 | public static void main(String args[]) {
try {
for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
if ("Nimbus".equals(info.getName())) {
javax.swing.UIManager.setLookAndFeel(info.getClassName());
... |
018348e2-c717-4ff3-8bd7-3d82e9c828c4 | 7 | private void progress(State s, StateBuffer nextBuffer, StateBuffer goalBuffer) {
curGb.restore(s);
int textSpeed = curGb.readMemory(curGb.pokemon.optionsAddress) & curGb.pokemon.optionsTextSpeedMask;
int[] allowedMoves = new int[(textSpeed <= 1 ? 1 : 0) + (textSpeed >= 1 ? 1 : 0)];
if (textSpeed <= 1)
... |
84d88121-ec16-4ccf-9ace-02f4fd72a387 | 6 | @RequestMapping(value = "/login", method = RequestMethod.POST)
public ModelAndView login(
@RequestParam String email,
@RequestParam String password) throws ApplicationException {
ModelAndView model = new ModelAndView();
if (null == email || null == password || "".equalsIgno... |
af4a40f8-2b56-4991-a39c-c319ede5bacd | 6 | @Override
public void run () {
logger.entering(loggerName, "run");
while (true) {
try {
//QueueElement qe = docq.poll();
WebQueueElement qe = (WebQueueElement) docq.poll();
if (qe == null) {
Thread.currentThread().sleep... |
751a1083-5920-454a-ac68-6d1e41d105e0 | 3 | public T get(int x) {
if (this.length != 0 && x < this.length) {
Node<T> ele = _head;
for (int i = 0; i < x; i++)
ele = ele.getNext();
return ele.getData();
}
return null;
} |
363152b7-eec1-4080-a0f8-49a48e5e0133 | 3 | @Override
public void actionPerformed(ActionEvent e) {
if(e.getSource()==this.botaoAddCupom){
this.agente.addCupomDesejado(textoCupomNome.getText(),Double.parseDouble(textoCupomPreco.getText()));
JOptionPane.showMessageDialog(null,agente.getQuantidadeDeCuponsDesejados());
} else if(e.getSourc... |
68fa49b5-cb83-45a8-b2fb-029a3ef51a7a | 7 | public static String invalidAttackReason(AIUnit aiUnit, Player other) {
final Unit unit = aiUnit.getUnit();
final Player player = unit.getOwner();
return (player == other)
? Mission.TARGETOWNERSHIP
: (player.isIndian()
&& player.getTension(other).getLevel(... |
78f94d5d-347c-4f5f-8760-5a850aea1698 | 8 | private static String[] ProcessMSG(String msg){
String processedMSG[] = new String[3];
boolean goodRead = true;
for (int i = 0; i < processedMSG.length; i++)
processedMSG[i] = "";
// msg format should be #checksum{data}
// process msg
processedMSG[0... |
02edd35a-6e46-480d-9e9a-dbf9c116113e | 7 | private boolean testArray(int[] ary) {
int[] aryCopy = ary.clone();
// 1. Auf CLOSETIME prüfen und positive Werte
for (int elem : aryCopy) {
if (elem < 0 || elem >= Timer.CLOSETIME)
return false;
}
// 2. Intervalle prüfen
if (aryCopy[0] >= ... |
f329a219-6480-4461-98fa-5bdb0ea4e7b3 | 6 | public void Collision()
{
Actor collision1 = getOneIntersectingObject(Spikyball2.class);
Actor collision2 = getOneIntersectingObject(Spikyball3.class);
Actor collision3 = getOneIntersectingObject(Ghost.class);
if(collision1 != null)//if you have not run into it
{
... |
29c73b00-7712-40dd-a3cb-6e7de4449516 | 4 | public void removeCard(String ID) {
for (Component c : table.getComponents()) {
if ((c.getClass().equals(TCard.class)
|| c.getClass().equals(Token.class))
&& ((TCard) c).getID().equals(ID)) {
table.remove(c);
table.repaint();
... |
025743b0-7343-435f-aed7-ca13875903f1 | 8 | public static VirtualMachine createVirtualMachine(VirtualMachineConfiguration cfg) throws VirtualMachineInstantiationException, SecurityException {
try {
File java = new File(System.getProperty("java.home"), "bin" + File.separator + "java");
String program;
if (cfg.getMainCla... |
809d24f7-aacb-4ed0-a9f5-a2a6cea7746b | 0 | public String getString () {
return string;
} |
b08e47d4-3e78-411a-9024-c5c7c80b3e69 | 5 | public void syncFileContent(String fileName, FileOperation fileOperation) {
byte operation = fileOperation.operation;
long fileLastModifiedTime = fileOperation.file.lastModified();
FileInputStream is = null;
try {
writeHasNextFileFlag(true);
if(operation == Dropbo... |
58d3fa66-fd8a-4303-9489-e2af6e91dd3f | 9 | public boolean skipPast(String to) throws JSONException {
boolean b;
char c;
int i;
int j;
int offset = 0;
int length = to.length();
char[] circle = new char[length];
/*
* First fill the circle buffer with as many characters as are in the... |
b78cade2-72e6-48c9-a95b-9f8ff1424249 | 3 | public static final int paethPredictor(int a, int b, int c)
{
int p = a + b - c;
int pa = abs(p - a);
int pb = abs(p - b);
int pc = abs(p - c);
if ((pa <= pb) && (pa <= pc))
{
return a;
}
else if (pb <= pc)
{
return b;
}
else
{
return c;
}
} |
286bc71a-390a-4359-a2d4-8b7794132c17 | 8 | @Override
public void initialize(InputSplit split, TaskAttemptContext context)
throws IOException, InterruptedException {
Configuration conf = context.getConfiguration();
// determine if any locations are local
ArrayList<String> sortedLocations = new ArrayList<String>();
ArrayList<String> localLocations ... |
30f3ab6a-030a-4936-b897-b71f186bb55b | 2 | public void setFilter(String filter) {
if (captor != null)
try {
captor.setFilter(filter, true);
} catch (IOException e) {
e.printStackTrace();
}
} |
f82d148c-e3fb-4321-99a8-ebc758d0710e | 6 | public static StringWrapper cppTranslateArrayType(ParametricTypeSpecifier arraytype) {
{ List dimensions = ParametricTypeSpecifier.arrayTypeDimensions(arraytype);
StandardObject elementtype = StandardObject.extractParameterType(arraytype, Stella.SYM_STELLA_ANY_VALUE, new Object[1]);
String translatedtyp... |
d1a9c78d-9138-4781-8611-60063b1ec356 | 7 | public boolean onCommand(CommandSender sender, Command cmd,
String commandLabel, String[] args) {
Player victim;
String mod;
String reason;
int display = 0;
if (commandLabel.equalsIgnoreCase("kick")) {
if (sender.hasPermission(SeruBans.KICKPERM) || sender... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.