method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
0d534f0c-f2f1-4534-9cfb-3102ea9c7c50 | 3 | public void run() {
lastLoopTime = System.currentTimeMillis();
while(true)
{
try { Thread.sleep(10); } catch (Exception e) {}
if(!game.isPaused()){
update();
lastLoopTime = System.currentTimeMillis();
}
}
} |
57973d0d-d3dd-4279-9edd-db702c22775e | 3 | ParsedStatement(List<ScriptSegment> pSegmentList){
mSegmentList = pSegmentList;
//Check statement delimiter is only at the end of the list, if at all
int i = 0;
for(ScriptSegment lSegment : mSegmentList){
if(lSegment instanceof StatementDelimiterSegment && i < pSegmentList.size()-1){
... |
9a7dbf5f-edbf-4fff-b67e-fb17a920fe41 | 9 | public void actionPerformed( ActionEvent e ) {
Object src = e.getSource() ;
/*
* Action pour l'item 'sauver' du menu 'Fichier'.
*/
if ( src == this.win.getItemSauver() ) {
this.win.getAnnuaire().sauver() ;
}
/*
* Action pour l'item 'charger' du menu 'Fichier'.
*/
else if ( src == this.win.get... |
a129698e-2407-4dc9-b28f-487222f3ecc7 | 8 | public int characterAt(int at) throws JSONException {
int c = get(at);
if ((c & 0x80) == 0) {
return c;
}
int character;
int c1 = get(at + 1);
if ((c1 & 0x80) == 0) {
character = ((c & 0x7F) << 7) | c1;
if (character > 0x7F) {
... |
d501dd13-2a6c-435e-8b6b-6d82c1963312 | 8 | public static boolean isRegularGrammar(List<Production> productions, Set<String> nonTerminals, Set<String> terminals) {
for (int i = 0; i < productions.size(); i++) {
Production p = productions.get(i);
if (nonTerminals.contains(p.getNonTerminal())) {
String temp[] = p.get... |
3f85204d-8f55-4873-917c-cfaea60ffe4f | 7 | public static String addBinary(String a, String b) {
String result="";
int newBit=0;
int addBit=0;
if(a.length() < b.length()){
result=b;
b=a;
a=result;
}
result="";
for(int i=0;i<a.length();i++){
if(i<b.length()){
new... |
630c8d79-9ed5-4749-8f7f-65adb384cdb0 | 6 | private void createAndManageRequest() {
if (mPeerPiecesAvailable == null) return;
Piece piece = mPieceManager.getNeededAndAvailablePiece( mPeerPiecesAvailable );
if (piece != null) { // The peer doesn't have any interesting piece.
if (!mAmIInterested) {
synchronized (mMessagesToSendQueue) {
mM... |
4bd556c1-856e-4bf4-8c6d-80c5f0cb1f28 | 9 | public static void main(String[] args){
window = new ConverterGUI();
EventQueue.invokeLater(new Runnable() {
public void run() {
try {
window.getFrame().setVisible(true);
window.setVersion("alpha 2.0");
} catch (Exception e) {
e.printStackTrace();
}
}
});
while(true)
... |
24b60d5f-e513-4d6c-97bc-16547b53ece1 | 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... |
71193ef1-5ab7-43b3-bfd9-ab38078173da | 3 | public void aloitaHyppy() {
/**
* Testataan onko hahmon alla maata. Aloitetaan hahmon vasemmasta
* laidasta
*/
Piste p0 = new Piste(this.getX() - 12, this.getY() + 1);
if (testaaVaakarivi(p0)) {
/**
* isoHyppy mahdollistaa hypyn korkeuden säät... |
40b042ef-6e65-40ea-a431-ae6e694619a8 | 7 | private static void updateItems(ArrayList<InventoryPackages> packagesDB){
Scanner updateItemScanner = new Scanner(System.in);
System.out.println("---------------------------------------------------------------------------------------------------------------------------------------------");
System.out.println(... |
bc6b215b-b1e4-4508-8f7c-702f0a8be930 | 1 | private <T> void exchangeWithLast(T[] array, final int index) {
if (currentSize > 1) {
// Bubble
T kt = array[index];
array[index] = array[currentSize - 1];
array[currentSize - 1] = kt;
}
checkEnoughCapacity(0);
} |
8396b801-7351-4387-bc5d-10691ae2b140 | 7 | public AxisState draw(Graphics2D g2, double cursor, Rectangle2D plotArea,
Rectangle2D dataArea, RectangleEdge edge,
PlotRenderingInfo plotState) {
// if the axis is not visible, don't draw it...
if (!isVisible()) {
AxisState state = new AxisState(cursor);
... |
ed271ac1-e5ac-409d-bc3a-c9ba6cea8e2d | 4 | public Action(String proto) throws Exception {
this.prototype = proto;
this.modelBuilder = new ModelBuilder(proto);
this.actionNumMap = new HashMap<String, Double>();
// We don't really need the dataset for prediction,
// just use it to get the connection between
// action and their values.
DatasetBui... |
af2f8c79-988a-42dd-b561-3c69a7d83578 | 9 | private boolean validarFecha(int d, int m, int a){
int diasDelMes[]={31,29,31,30,31,30,31,31,30,31,30,31};
if(a<=0) {
return false;
}
if(d<=0 || d>31) {
return false;
}
if(m<=0 || m>12) {
return false;
}
if(d>di... |
f1380220-5386-4dfe-9c03-46596883c339 | 5 | public static void main(String args[]) {
if (args.length != 1 && args.length != 2
|| (args.length == 2 && !args[0].equals("-d"))) {
System.out.println(
"Incorrect usage, try: java interpreter.Interpreter [-d] <file>");
System.exit(1);
}
Str... |
896eb53f-4cfd-4460-83fc-dd2586463778 | 0 | public Run(){} |
92e4d9d1-44be-47e4-942e-b8a689f9b7ec | 5 | public void paintComponent(Graphics g) {
//clears graph.
g.setColor(Color.gray);
g.fillRect(0,0,width,height);
//draws grid.
g.setColor(new Color(230, 230, 230));//greyish
if (restrictedRange) {
yStart = (int)(yAxisLoc-(scale*range1));
yEnd = (int)(yAxisLoc+(scale*range2));
} else {
yStart = y... |
376b3ed5-c089-43f3-a9ac-9c4bbdce2f11 | 0 | public int getDaysInMonth()
{
return daysInMonth;
} |
3cefaa2a-7b56-4674-8d4d-97364d8e4ba5 | 5 | public MinuetoFont(String fontName, int fontSize, boolean bold, boolean italic) {
int style;
if ( fontSize < 1 ) new MinuetoZeroNegativeException("Cannot create a font of size " + fontSize);
if ( fontName == null ) new NullPointerException();
style = 0;
this.fontSize = fontSize;
... |
b12e575b-4aa7-4f99-9b22-fd2108c2ab91 | 5 | private void placeAsteroids () {
//if initial large asteroid speed is 3, for round 2 is 4, and round 3 and 4 it is 5
int speed = 3;
if (asteroids < 134)
speed = 4;
if (asteroids < 99)
speed = 5;
Participant a = new Asteroid(0, 2, EDGE_OFFSET, EDGE_OFFSET);
a.setVelocity(speed, random.nextDouble()*2... |
b01a3a8f-5dfc-40e5-9ab7-44807d431e56 | 0 | public void setNames(String leftName, String rightName)
{
this.leftName = leftName;
this.rightName = rightName;
notifyListeners();
} |
c4ab5411-c4f7-4c55-8669-87bb6d1a483c | 7 | public boolean myWalk(final org.powerbot.script.Tile tile) {
final double currentDistance = tile.distanceTo(ctx.players.local());
if (currentDistance <= 4) {
return true;
}
if (!ctx.players.local().inMotion() || ctx.movement.distance(ctx.movement.destination(), ctx.players.local()) < Random.nextInt(2, 5)) {... |
27e9f9d0-566d-4b00-8792-8750c6cb09e5 | 7 | public static void main(String[] args) throws IOException, ParseException {
int classNumber = 5; //Define the number of classes in this Naive Bayes.
int Ngram = 1; //The default value is unigram.
String featureValue = "TF"; //The way of calculating the feature value, which can also be "TFIDF", "BM25"
int norm... |
f49cc799-672d-48ac-a7d9-70b9b2e98365 | 1 | public static void callCommand(Command command, Object data) throws Exception
{
try {
command.execute(data);
} catch (Exception e) {
TakesScreenshot(getDriver(),"ABCD");
e.printStackTrace();
}
getDriver().close();
} |
27a906ac-c5e8-4d31-b744-27cb83f5d952 | 9 | private Board2048 moveBoard(Board2048 board, int x, int y, int dx, int dy) {
int origx = x, origy = y;
// Change the board values
while ((0 <= x && x <= (N - 1)) && (0 <= y && y <= (N - 1))) {
board.setBoard(elimiZero(board.getBoard(), origy, origx, dy, dx));
if (y + dy >= 0 && y + dy <= (N - 1) && x + dx >... |
97e27e78-aa31-48a7-b922-ede558d631c4 | 0 | public AppTest( String testName )
{
super( testName );
} |
048aca42-edab-4fdc-8d2a-96842fbb4ae1 | 0 | public String getName(){
return this.name;
} |
81ef5400-906a-446f-9f35-69fe07d5c5f4 | 6 | public static void main(String[] args) throws XMLStreamException, FactoryConfigurationError, IOException {
String eadfile = args[0];
String identifier;
String attrName=null;
String attrValue=null;
if (args.length >= 2) {
if (args[1].equals(DID)) {
id... |
623a6185-fbab-4cf2-9fdc-8c5d6728d043 | 1 | public BufferedImage loadBufferedImage(String image){
try {
return ImageIO.read(new File(image));
} catch (Exception e) {
e.printStackTrace();
}
return null;
} |
72b7b5dc-9d5c-4b34-bf27-65c210b31304 | 0 | public File getImage() {
return image;
} |
f9dbe1ee-8518-4976-bb9b-fc9e40c6bcf2 | 3 | public static void sort (Long[] array){
System.out.println("Sorting sorted[] ...");
for(int i = 0; i <array.length-1; i++)
for(int j = i+1; j<array.length; j++)
if(array[i] > array[j])
{
Long t = array[i];
array[i] = array[j];
array[j] = t;
}
} |
52e1ad04-ce69-4b22-ab69-f51eabe2b3c9 | 5 | int open_seekable() throws JOrbisException{
Info initial_i=new Info();
Comment initial_c=new Comment();
int serialno;
long end;
int ret;
int dataoffset;
Page og=new Page();
// is this even vorbis...?
int[] foo=new int[1];
ret=fetch_headers(initial_i, initial_c, foo, null);
se... |
7fd62638-f20b-4a27-8148-fe4ddfa5b493 | 6 | @Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
Controleur other = (Controleur) obj;
if (ruleset == null) {
if (other.ruleset != null)
return false;
} else if (!ruleset.equals(other.ru... |
402ce306-fddb-4429-a73d-2f9c4db7ad3e | 6 | public ArrayList<String> getOutofStockBooks() throws Exception{
Connection connect = null;
Statement statement = null;
ResultSet resultSet = null;
ArrayList<String> outOfStockBooks = new ArrayList<String>();
try {
// First connect to the database
connect = DriverManager.getConnection("jdbc:... |
9c89a9bd-a880-430f-b43d-387ee58aac1a | 4 | public int FantasmaY(int n){
Query q2;
Variable a = new Variable("X");
Variable b = new Variable("Y");
switch(n){
case 0:
q2 = new Query("blinky", new Term[]{a,b});
return java.lang.Integer.parseInt(q2.oneSolution().get("Y").toString());
... |
b07725ca-fcdc-4d05-b47a-ed1de853f0cd | 6 | private List<List<Gate>> getSortedGates(List<Gate> gates) {
List<List<Gate>> res = new ArrayList<List<Gate>>();
GateTypes current = null;
int index = 0;
Gate trial = gates.get(0);
if (trial.isXOR()) {
current = GateTypes.XOR;
} else if (trial.isAND()) {
current = GateTypes.AND;
} else if (trial.isI... |
e4d419eb-79cd-4b8a-b017-77212d46776a | 5 | public static void main(String[] args)
{
if (args.length > 1)
{
try
{
int arraySize = Integer.parseInt(args[0]),
maxValue = Integer.parseInt(args[1]);
if (arraySize > 0)
{
int array[] = new int[arraySize];
fillWithRandomValues(array, maxVa... |
5ef0f570-a750-4dca-bc13-afb8eefd0a17 | 3 | public static Reminder[] getRimindersByUserMail(String userMail) {
XStream xstream = new XStream(new DomDriver());
Reminder[] allReminders = new Reminder[0];
try {
File file = new File((String) Server.prop.get("reminderFilePath"));
allReminders = (Reminder[]) xstream.fromXML(file);
} catch (Exception e... |
e6595d0c-7a4b-47e0-ab91-23a65bfa052f | 8 | public ArrayList<Cell> getDefaultSeatingOrder(DefaultSeatingMethod seatingMethod) {
if (this.planeDimension.getNormalSeats().length == 0) {
return this.randomisedPrioritySeats;
}
switch (seatingMethod) {
case BACK_TO_FRONT:
return this.calculateBackToFro... |
3b1029be-ce89-47e6-99e3-ef0b4819474d | 1 | public String getBackground() {
if (styles == null) {
return null;
}
else {
return styles.get("bg");
}
} |
33599773-ccfd-4a4c-81fb-01599da7119f | 3 | public void serialize(String roll, String name) {
Properties prop = new Properties();
InputStream istream = getClass().getClassLoader().getResourceAsStream("com/file/resources/searchtree.properties");
try {
prop.load(istream);
String pathLocation =prop.getProperty("path");
File file = new File(... |
981764d4-3362-4a5c-83fb-79decbbf4610 | 5 | public static void sendMail(Mail mail) {
if(mail.sentTo().equals("__ALL_USERS__")) {
for(String entry : dataDir.list()) {
if(entry.equals("__ALL_USERS__"))
continue;
File box = new File(dataDir, entry);
if(!box.isDirectory())
continue;
int mailIndex = getBoxSize(box);
File location... |
9cceba24-7b08-4696-b8a5-6e15e502f323 | 4 | public void setTool(int tool) {
tp.setTool(tool);
if(tool == 0) {
pencil.setSelected(true);
} else if(tool == 1) {
fill.setSelected(true);
} else if(tool == 2) {
chooser.setSelected(true);
} else if(tool == 3) {
line.setSelected(true);
}
curTool = tool;
} |
251cda5c-1b03-4ef3-b284-f2183cf7796f | 3 | protected void processRequest(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException, SQLException {
HttpSession sesionOk = request.getSession();
if (sesionOk.getAttribute("usuario") != null) {
response.setContentType("text/html;charset=UTF... |
16b819fc-acd7-47a0-a683-417c18abe624 | 1 | public static String removeDelimiters(String string) {
int length = string.length();
if (length < 3)
throw new RuntimeException("Cannot remove delimters from " + string);
return string.substring(1, length - 1);
} |
63765fc5-f068-46c4-8ace-4ad8bec7bd72 | 7 | @Override
public Success<Expression[]> parse(String s, int p) {
// Parse the '('.
if (s.charAt(p++) != '(')
return null;
p = optWS(s, p);
// Handle empty argument lists.
if (s.charAt(p) == ')')
return new Success<Expression[]>(Expression.NONE, p + 1);... |
945bc40b-1a75-4e66-bec1-d07a1f4f9dd9 | 8 | @Override
public void animate( long timeProgress ) {
int nextX = targetBounds.x;
int nextY = targetBounds.y;
int nextWidth = targetBounds.width;
int nextHeight = targetBounds.height;
if( targetBounds.x != -1 ) {
int deltaX = targetBounds.x - initialBounds.x;
... |
9c163ecf-54a2-4fb6-95d0-54e2f5380d46 | 7 | String getCallbackFunctionCall(FunctionTrace ft) {
// Ensure ft is of type ASYNC_CALL
String type = getLineType(ft);
if (!type.equals("ASYNC_CALL")) {
System.out
.println("Error: Cannot get callback function call from non-ASYNC_CALL trace");
System.exit(-1);
}
// Find which index contains the vari... |
201ae2ab-8cbe-49be-b6d5-4d130b0db680 | 5 | public boolean sameEnd(Temporal temporal) {
if (endTime != temporal.endTime) return false;
boolean ins = isTimeInstance();
boolean tins = temporal.isTimeInstance();
if ((ins && tins) || (!ins && !tins)) return true;
return false;
// return sameEndTime(temporal.endTime);
// return endTime == temporal.endTi... |
108a29a1-2844-4215-a915-03e1550d4e91 | 5 | public static void sort(Comparable[] a)
{
// Sort a[] into increasing order.
int N = a.length;
int h = 1;
while (h < N / 3)
h = 3 * h + 1; // 1, 4, 13, 40, 121, 364, 1093, ...
// h-sort the array.
while (h >= 1)
{
// Insert a[i] among a[i-h], a[i-2*h], a[i-3*h]... .
for (int i = h; i < N; i++)
... |
b011114b-3be2-459a-a4a5-079ea95f2f42 | 2 | public static int[] CountElmt(ArrayList<Integer> newScores1,
ArrayList<Integer> scores) {
int a[] = new int[scores.size()];
for (int i = 0; i < scores.size(); i++) {
a[i] = 0;
}
for (int i = 0; i < newScores1.size(); i++) {
int value = newScores1.get(i);
int pos = scores.indexOf(value);
a[pos]++;... |
f747325f-c8ba-4c76-a0db-e96e0a16d3fc | 6 | public int addNum(int numA, int numB){
System.out.println("A: " + numA + ", B: " + numB);
if(numA > 15 || numB > 15){
System.out.println("Sorry, we can't use the numbers length longer than 4bits.");
return -1;
}
boolean[] binaryA = getBinaryFromDecimal(numA, 4);
boolean[] binaryB = getBinaryFromDec... |
f656ee49-ffa1-4b81-bee9-51760e4bd622 | 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 DatasetKeyword)) {
return false;
}
DatasetKeyword other = (DatasetKeyword) object;
if ((this.datasetKeywordPK =... |
9050e7f9-6fcd-472a-bdbd-ef9ab0ae0d5b | 6 | public PageDescriptor()
{
super();
xmlName = "Page";
elementDefinition = true;
org.exolab.castor.xml.util.XMLFieldDescriptorImpl desc = null;
org.exolab.castor.mapping.FieldHandler handler = null;
org.exolab.castor.xml.FieldValidator ... |
9c392510-d48b-4e1d-aaa9-5da0b127b888 | 5 | public boolean hiddenSingle(GameGrid g){
for(GameStructures gs : g.getStructures()){
for(int i = 0; i < gs.getMembers().size(); i++){
Stack<Cell> candidateStack = new Stack<Cell>();
for(Cell c : gs.getMembers()){
if(c.getCandidates().contains(Int... |
96f848b8-7021-44c9-8005-d9d4cb049ed9 | 2 | @Override
public void doAction(Player player, Grid grid) throws InvalidActionException {
if (player.getRemainingTurns() <= 0)
throw new InvalidActionException("The player has no turns left!");
Position currentPos = player.getPosition();
Position newPos = new Position(currentPos.getxCoordinate() - 1, curren... |
a73cfd76-9786-47cb-95aa-2c9b7c686f33 | 6 | protected static final int codePointAt(CharSequence seq, int index, int end) {
if (index < end) {
char c1 = seq.charAt(index++);
if (c1 < Character.MIN_HIGH_SURROGATE ||
c1 > Character.MAX_LOW_SURROGATE) {
// Fast path (first test is probably all we need t... |
b6e55c26-26d1-4719-97cf-58e0e5f26c19 | 6 | void setOrder( HashMap < Integer, Integer > checkForMultipleResult )
{
ArrayList < PlayingCard > tempUsedCards = new ArrayList < PlayingCard >();
ArrayList < PlayingCard > tempUnusedCards = new ArrayList < PlayingCard >();
ArrayList < Integer > keySet = new ArrayList < Integer >();
keySet.addAll( checkForMulti... |
9e1e12bf-4c17-4ba9-a926-a7fc5df282f5 | 6 | @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 VendaItem)) {
return false;
}
VendaItem other = (VendaItem) object;
if ((this.id == null && other.id != null) |... |
fbe9f223-695c-4e5c-a456-3c1edb348572 | 3 | public WorldGrid(int x, int y, int width, int height) {
tiles = new ArrayList<ArrayList<GridTile>>();
heldPeople = new ArrayList<Being>();
this.x = x;
this.y = y;
this.width = width;
this.height = height;
for(int i = 0; i < width/32; i++) {
tiles.add(n... |
e5b52787-2cb4-4d88-b730-e843cfd769d2 | 0 | @Override
public void addObserver(Observer o)
{
plateau1.addObserver(o);
plateau2.addObserver(o);
} |
df5dc449-96e8-4af5-8b03-8349ea5324ad | 7 | public boolean esColor(boolean comprobado) {
boolean hayColor = false;
for (int i = 0; i < arrayPalos.length; i++) {
if (arrayPalos[i] >= 5) {
arrayNums = new int[]{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
arrayPalos = new int[]{0, 0, 0, 0};
fo... |
386f72de-6afa-4dee-ac2d-b4fdde285770 | 4 | public static void disconect() {
if (isMultiplayer && hasStarted) {
Packet01Disconnect packet = new Packet01Disconnect(Page.getClientName());
packet.writeData(page.socketClient);
if (page.socketClient != null) page.socketClient.stopClient();
if (page.socketServer != null) page.socketServer.stopServer();
... |
54d9e53e-6540-4be9-b891-539985b27540 | 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 Vehicle)) {
return false;
}
Vehicle other = (Vehicle) object;
if ((this.id == null && other.id != null) || (thi... |
4c475dbf-eaea-4b49-8f8a-d7f351695525 | 1 | public boolean mightBeManagedBy(int firewallId) {
return firewallId == firewallId1 || firewallId == firewallId2;
} |
3c9cb57b-c3d2-4314-8c89-26ff0c799d8f | 7 | public Attraction[] askHeadToHead(){
Attraction[] temp = new Attraction[2];
if(tagCount < tags.size()){
currentTag = tags.get(tagCount++);
//System.out.println(currentTag);
if((hhCounter < algorithmParam.numHH) && !currentTag.equals("DONE")){
System.out.println(currentTag);
if((hhCounter < algori... |
bfe463df-51fc-4a2f-ab6e-ed1fed87fad0 | 0 | public static String getWebRoot() {
return getClassPath().split("WEB-INF")[0];
} |
7d38e83e-dedc-4540-8d7a-37b9128ad019 | 4 | public void updateHousehold(Household hh) throws InstanceNotFoundException {
boolean found = false;
Iterator<Household> iter;
iter = households.iterator();
while (iter.hasNext() && !found) {
Household h = iter.next();
if (h.equals(hh)) {
found = true;
h.setMentored(hh.getMentored());
h.setBill... |
2d927077-c29f-4714-8c22-799b7044899c | 1 | public void updateProduct() {
try {
Database db = dbconnect();
String query = "UPDATE product SET name = ?, "
+ "description = ? "
+ "WHERE PID = ?";
db.prepare(query);
db.bind_param(1, t... |
a85d8556-fdb3-4485-b3ef-cb803f5d5491 | 7 | void stopJob() {
if (is != null)
try {
is.close();
} catch (IOException e) {
}
if (fos != null)
try {
fos.close();
} catch (IOException e) {
}
if (fis != null)
try {
fis.close();
} catch (IOException e) {
}
if (in != null)
in.close();
blockView(false... |
647308f8-c0e0-4797-9157-b028269f1a16 | 4 | private Direction getNewDirectionFromPosition(Position primaryPos, Position secondaryPos) {
int dirInt = getDirectionInt();
if (rotation == Rotation.CLOCKWISE) {
dirInt++;
if (dirInt >= Direction.values().length)
dirInt = 0;
} else if (rotation == Rotation.COUNTER_CLOCKWISE) {
dirInt--;
if (d... |
45477963-dae2-44ab-a021-467893a06907 | 8 | @Override
public boolean equals(Object object) {
if (this == object)
return true;
if (object == null || getClass() != object.getClass())
return false;
if (!super.equals(object))
return false;
BaseTemplateTap that = (BaseTemplateTap) object;
if (parent != null ? !parent.equals(t... |
3f31d199-9d6c-4b8b-8fb3-bf82180e5421 | 3 | @Override
public void run() {
// TODO Auto-generated method stub
try {
while((message = reader.readLine()) != null && !message.equals(".")) {
System.out.println("Server received message: " + message);
handler.MessageReceived(message);
}
} catch (IOException e) {
// TODO Auto-generated c... |
393485e2-444f-40d2-9581-6cf9c2a7d40c | 4 | void parseAttribute(String name) throws java.lang.Exception
{
String aname;
int type;
String value;
// Read the attribute name.
aname = readNmtoken(true).intern();
type = getAttributeDefaultValueType(name, aname);
// Parse '='
parseEq();
// ... |
1f495d8c-fa58-4115-8921-dd7ea84e6e79 | 8 | public static void findCombosSort(int[] ar) {
// sort the array
Arrays.sort(ar);
// go from left to right and find pairs of numbers to the right that combine for form the sum
for(int i=0; i<ar.length; i++) {
int lowInd = i+1;
int highInd = ar.length-1;
... |
107bbd20-d19b-4a01-82bb-7cb46a0dc109 | 3 | public Monster zoekMonster(int teZoekenIdmonster)
{
Monster monster = null;
try (Connection conn = DriverManager.getConnection(JDBC_URL)) {
PreparedStatement queryZoekMonster = conn.prepareStatement("SELECT FROM MONSTER WHERE IDMONSTER = ?");
queryZoekMonster.setInt(1, teZoe... |
186eaf60-9ff7-418d-bc63-d8924f25da46 | 6 | @Override
public Group parse() {
if(!this.prepared) {
this.prepared = true;
StringBuilder sB = new StringBuilder();
sB.append("(");
Iterator<Object> elemIterator = this.elems.iterator();
while(elemIterator.hasNext()) {
Object eRaw = elemIterator.next();
if(eRaw instanceof Elem) {
... |
2dc8f16f-2363-4465-a377-5567bf26abc2 | 0 | public Retangulo(double x, double y, double l, double a) {
super(x, y);
largura = l;
altura = a;
} |
5cdf36bb-c5ef-45b3-b8ec-df8697412d36 | 3 | public void move(int row, int column){
switch(row){
case 0:
RowA.move(column);
break;
case 1:
RowB.move(column);
break;
case 2:
RowC.move(column);
break;
}
} |
8a98be20-cef4-4be8-aa86-c3dd7b3b4193 | 8 | public static Environment getEnvironment(byte e) {
switch (e) {
case 'W':
case 'w':
return WINDOWS;
case 'L':
case 'l':
return LINUX;
case 'M':
case 'm':
case 'O':
case 'o':
return MAC;
default:
throw new IllegalArgumentException();
}
} |
43e424f1-f3db-4201-9ad0-c44124b4bd7a | 2 | @Override
public String toString(){
Node toReturnString = root;
while(!(toReturnString instanceof LeafNode)){
toReturnString = toReturnString.getChild(0);
}
if(toReturnString instanceof LeafNode){
return toReturnString.toString();
}
return "FAIL";
} |
8e47a138-0da8-4aca-8fed-595a65ef3918 | 0 | public void add(String data, Flyweight fw) {
flies.put(data, fw);
} |
904a7b2e-404c-4bac-9b43-25dd85072902 | 8 | public final int compare(Object a, Object b){
if (a==null || b==null) return -1;
java.util.Date d1 = null;
java.util.Date d2 = null;
if (a instanceof java.util.Date) d1 = ((java.util.Date) a);
else if (a instanceof javaxt.utils.Date) d1 = ((javaxt.utils.Dat... |
9715541c-c979-4317-ac5a-9a84ffd8f8cd | 4 | public boolean spam() {
synchronized (this) {
if (!canUse() || !start())
return false;
final TimedCondition tc = new TimedCondition(1000) {
@Override
public boolean isDone() {
return !canUse() || BarNode.this.isDone();
}
};
do {
send();
Task.sleep(300, 400);
} while (tc.isR... |
ab3dfdf5-2372-4231-acf5-b961f6fe183e | 0 | public void setOnSaleDatetime(Date onSaleDatetime) {
this.onSaleDatetime = onSaleDatetime;
} |
8694ba35-4d3e-4b49-be49-052e4c50e986 | 2 | public Iterable<WeightedDirectedEdge> edges()
{
List<WeightedDirectedEdge> b = new LinkedList<WeightedDirectedEdge>();
for (int v = 0; v < V; v++)
for (WeightedDirectedEdge e : adj[v])
b.add(e);
return b;
} |
60263ce3-bf56-4a8b-a25e-5af2fd0f850a | 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... |
13ab1f0d-2f70-4d53-be07-376679f2d286 | 1 | public boolean hasCommand(Command _command) {
if(this.commands.contains(_command)) {
return true;
} else {
return false;
}
} |
c6dcfdef-0894-4b2e-a30c-de62a65eff48 | 3 | @Override
public void doCharacterCollision(ArrayList<Collision> collisions, StageObject stageObject)
{
/**
* @todo remove tempory fix
*/
Collision collision = collisions.get(0);
if (stageObject instanceof mario.Stages.StageMario)
{
if (hadCollision)
... |
dcb5da4b-0c8c-45e1-9962-3bba60116292 | 3 | public void affiche () {
if ( this.numero() < 10 ) {
System.out.print(' ');
}
System.out.print(numero());
System.out.print(' ');
System.out.print(status);
System.out.print(' ');
if ( estRapide ) {
System.out.print('R');
} else {
System.out.print('-');... |
8fab791a-0240-474b-b157-5f08659273a4 | 4 | public String CambiarFilas ()
{
String Impresion="";
String Impresion2="";
for (int i = 0; i < Matriz2.length; i++) {
for (int j = 0; j < Matriz2.length; j++) {
if(j==0){
Impresion+=Matriz2[i][j]+" ";
}
if(j==1){... |
2028c031-40bb-4148-831d-61a4b9a12a31 | 9 | public static DiagramComponent createOpenFromBoundaryCells(
final TextGrid grid,
final CellSet boundaryCells,
final int cellWidth,
final int cellHeight,
boolean allRound) {
if(boundaryCells.getType(grid) != CellSet.TYPE_OPEN) throw new IllegalArgumentException("This shape is closed and cannot be han... |
fcdc184c-a079-454d-b0e5-e54098cfc4e0 | 5 | @EventHandler
public void onVehicleDamage(VehicleDamageEvent event)
{
if(plugin.boats && event.getVehicle() instanceof Boat)
{
Boat b = (Boat)event.getVehicle();
if(!MorePhysics.sinking.contains(b) && !b.isDead() && (event.getDamage() >= 2))
{
MorePhysics.sinking.add(b);
... |
0f55a20b-998c-4dc6-9ea8-c20885445be4 | 7 | public void mousePressed(MouseEvent e){
if (tipoObjeto==CONST.PUNTERO){
Figura figura ;
boolean b=false;
if (listaFigura != null){
for ( int i=0 ; i<listaFigura.size() ; i++ ) {
figura = listaFigura.get(i);
if ( figura.... |
0895d56c-07a4-4cc5-a4b7-e5fd7aa87936 | 6 | protected void createSubbands()
{
int i;
if (mode == Header.SINGLE_CHANNEL)
for (i = 0; i < num_subbands; ++i)
subbands[i] = new SubbandLayer2(i);
else if (mode == Header.JOINT_STEREO)
{
for (i = 0; i < header.intensity_stereo_bound(); ++i)
subbands[i] = new SubbandLayer2S... |
e2751a29-54c2-40f3-807e-d6c3f6c1728f | 0 | @Override
public void setServerPort(Integer port) {
this.serverport = port;
} |
ffe763ff-9931-4a5b-8cf5-e8be877713c8 | 0 | @Override
public String toString() {
return "[lineNumber=" + lineNumber + ", value=" + value + ", dataType="
+ dataType + "]";
} |
789cb9fb-fa3d-4d06-ac7e-63fd3b9087e8 | 1 | protected static String processRegister(String text) {
StringBuilder output = new StringBuilder("");
text = RegEx.removeAll(text, Patterns.REGISTER);
String[] arr = text.split("\\|");
output.append("<span class=\"linguisticRegister\">[");
for (String string : arr) {
... |
509c280e-6927-491f-a072-328ff5f3604c | 1 | public void generateValue()
{
if(parent == null)
currentScore = 0;
else
currentScore = parent.getCurrentScore();
localScore = IntervalEvalutation.getScore(this, song);
currentScore += localScore;
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.