method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
396bb014-d039-4804-b6e9-018bcdfcc6ed | 5 | public final Raster getRaster(int x, int y, int w, int h) {
if (w == 0 || h == 0) {
return null;
}
//
// If working raster is big enough, reuse it. Otherwise,
// build a large enough new one.
//
WritableRaster raster = saved;
if (raster == nul... |
c66622e7-1a5c-438d-bc22-7a5eb63d22a1 | 0 | public long getBytesRead()
{
return bytesRead;
} |
1571a47b-3b37-45b0-b01f-97b65ae9f28a | 8 | protected NeighborList findNeighbors(Instance bag, int kNN, Instances bags){
double distance;
int index = 0;
if(kNN > bags.numInstances())
kNN = bags.numInstances() - 1;
NeighborList neighborList = new NeighborList(kNN);
for(int i = 0; i < bags.numInstances(); i++){
if(bag != bags.inst... |
da0a69c0-8579-4d39-bd77-7b905b819515 | 4 | @Override
public void caseAVetorVariavel(AVetorVariavel node)
{
inAVetorVariavel(node);
if(node.getIdentificador() != null)
{
node.getIdentificador().apply(this);
}
if(node.getAbreColchete() != null)
{
node.getAbreColchete().apply(this);
... |
222372da-a095-4a45-bdc8-0e76be3ca70b | 0 | public void printChildren(Graphics g) {
} |
c9bc95a9-e249-4252-8dd0-dfcab7fe6da0 | 1 | public static boolean checkEmail(String email) {
String regex = "([a-zA-Z0-9_\\-\\.]+)@((\\[[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.)|(([a-zA-Z0-9\\-]+\\.)+))([a-zA-Z]{2,4}|[0-9]{1,3})";
if (Pattern.matches(regex, email)) {
return true;
}
return false;
} |
d0020cf2-02a7-4227-a075-85ed8e1a5e11 | 2 | public Trajet getTrajetByID(int id){
for(Trajet t : listeTrajets){
if(id==t.getID())
return t;
}
return null;
} |
50860ff6-87eb-41a9-afd8-8c3148598967 | 9 | public final CanecaArvore.expressaoMultiplicativa_return expressaoMultiplicativa() throws RecognitionException {
CanecaArvore.expressaoMultiplicativa_return retval = new CanecaArvore.expressaoMultiplicativa_return();
retval.start = input.LT(1);
CommonTree root_0 = null;
CommonTree _fi... |
32d5c52b-6adf-4c28-8bd9-5031b40c913d | 8 | public synchronized void holdTeamMeeting(TeamLead tl){
tl.inMeeting = true;
while(!tl.areDevsAllHere())
{
try{
tl.sleep(5);
}
catch(InterruptedException e)
{
e.printStackTrace();
}
}
conferenceW... |
0b75e963-19be-4807-bc77-febf86dcfb08 | 4 | public void undo() {
if (prevSpeed == CeilingFan.HIGH) {
ceilingFan.high();
}
if (prevSpeed == CeilingFan.MEDIUM) {
ceilingFan.medium();
}
if (prevSpeed == CeilingFan.LOW) {
ceilingFan.low();
}
if (prevSpeed == CeilingFan.OFF) {... |
a0abc67b-8d6f-4f7c-93b7-fa0bcbccd6ba | 8 | private long hash64(final byte[] data, int offset, int length, int seed)
{
final long m = 0xc6a4a7935bd1e995L;
final int r = 47;
long h = (seed&0xffffffffl)^(length*m);
int length8 = length/8;
for (int i=0; i<length8; i++) {
final int i8 = i*8;
long... |
8c0fcb42-d0d3-41da-9777-fd5bed94cbaa | 9 | private void step4() {
if (this.sb.length() > 1) {
char ch = this.sb.charAt(this.sb.length() - 1);
if (ch == 's') {
char b = this.sb.charAt(this.sb.length() - 2);
if ((b != 'a') && (b != 'i') && (b != 'o') && (b != 'u') && (b != 'è') && (b != 's')) {
... |
956a58ab-15a6-40ca-b718-5806108fb0a7 | 1 | @Override
public void endTransaction() {
if(commit()){
this.transaction = false;
}
} |
93423036-d18a-42bf-98a3-36d1233d6909 | 0 | public Rate getULRate() {
return this.upload;
} |
0fae6267-20b7-4c5e-8775-c9fce6395fa4 | 2 | public void registerHealRegion(String arena, HealRegion healRegion) {
if (getHealRegion(arena) != null) {
getServer().getScheduler().cancelTask(getHealRegion(arena).getTimer());
}
if (healRegion != null) {
arenas.get(arena).setHealRegion(healRegion);
healRegion.startTimer();
}
} |
fa302fb6-aa8a-4c66-a7dc-1a02c49cb3dc | 2 | public void init(GLAutoDrawable gLDrawable) {
Thread.currentThread().setPriority(Thread.MAX_PRIORITY);
getGL2(); // Repopulate gl each frame because it is not guaranteed to be persistent
gl.glShadeModel(GL2.GL_SMOOTH);
gl.setSwapInterval(1); // Enable V-Sync supposedly
gl.glCle... |
408feb23-c51d-4700-96df-9d316782910e | 1 | public static boolean isWisp (Entity entity) {
if (entity instanceof Bat) {
Bat Wisp = (Bat) entity;
return true;
}
return false;
} |
4963d920-931f-4473-956a-7c6a3c0506ca | 9 | public void actionPerformed(ActionEvent e) {
/* ...Main window buttons... */
// ...Add user button
if (e.getActionCommand() == "Add User") {
addUserView = new AddUserView(this);
list = new String[2];
}
// ...Log in button
if (e.getActionCommand() == "Log In") {
System.out.println("Du tryckte ... |
69c9300c-62bf-4a13-894f-a71b4ba5e8da | 4 | public int getBlockTextureFromSideAndMetadata(int var1, int var2) {
return var1 == 1?21:(var1 == 0?21:(var2 == 1?116:(var2 == 2?117:20)));
} |
00a3726d-89aa-4ef2-9e5f-679dad69af49 | 9 | public void insertInPosition(int posicion, T datos) {
if (posicion >= 0 && posicion <= getLength()) {
if (posicion == 0 || posicion == getLength()) {
if (posicion == 0) {//si la posicion es al inicio.
// System.out.println("entro");
AddHead(dat... |
5ebc5960-d785-4081-9b2b-2464c3c18aac | 0 | public Product getProductById(Long id) {
return em.find(Product.class, id);
} |
c147e9f3-df20-4080-a7d4-8a81d649b265 | 5 | public double playFromGivenState(BestMoveFinder bestMoveFinder, int[][] board, boolean shouldLog) {
do {
if (shouldLog) {
System.out.println("After spawn:");
OriginalGamePlayer.print(board);
}
Move move = bestMoveFinder.findBestMove(board);
... |
63d2dbd4-c940-4569-b9d4-692285100dcf | 6 | public static void main(final String args[]) {
ApplicationLauncher l = new ApplicationLauncher();
if(args.length == 0) {
reportUsage();
System.exit(0);
}
if(args[0].equalsIgnoreCase("generate")) {
try {
l.writeConfigurationFile();
} catch (JAXBException e) {
LOGGER.error("Problems writing... |
fcce3036-b952-4abc-a922-281cfefceb4a | 5 | public static void getNeighbors(Grid grid, int cellID){
Entity currentCell = grid.getEntity(cellID);
currentCell.setLiveNeighbor(0);
int currentTargetID = 0;
for(int x = 0; x < 3; x++) {
for(int y = 0; y < 3; y++) {
currentTargetID = getTargetOffset(x, y, gri... |
8fc498b1-6eb6-4fac-965b-d5f07121fafb | 0 | public int GetMaximumPassenger()
{
return maximumPassenger;
} |
8e894eac-4df1-4c5f-9136-2f1b8a0f38e9 | 9 | public static AIGraph importExample(AIGraph graph, String example, String[] arrAttrNames) {
AIGraph ret = null;
InputStream is = null;
try {
//die gewünschte Datei einlesen.
is = Importer.class.getResourceAsStream("examples/"+example+".graph");
//Buffered Reader um zeilenweise zu lesen
Buffe... |
8c90097a-7297-4650-921d-96e0bf31c46c | 5 | public static boolean warpStartDojo(final MapleCharacter c, final boolean party) {
int stage = 1;
if (party || stage == -1 || stage > 38) {
stage = 1;
}
final int mapid = 925020000 + (stage * 100);
final ChannelServer ch = c.getClient().getChannelServer();
for (int i = mapid; i < mapid + 15; i++) {
fin... |
adac54f8-f4b5-443e-984c-522302ec0d37 | 6 | @Test
public void testVisitDocument() {
System.out.println("visitDocument");
System.out.println("ObjectDocument: get(Object)");
Person person = new Person("Bill","Smith", new Date(), 1);
Order order = new Order(125L, 12345);
person.setOrder(order);
Document d... |
cb7a7ab4-18d1-4ef1-9a4e-9728491a7b80 | 8 | public static boolean igualesObjetivo3(final String ine, final String osm) {
if (StringUtils.isBlank(ine) || StringUtils.isBlank(osm)){
return false;
}
if (ine.toUpperCase(LOCALE_ES).equals(osm.toUpperCase(LOCALE_ES))){
return true;
}
if (normaliza1(ine).e... |
834c53f0-67bc-4ba0-875f-a6e3bd121106 | 6 | public static void main(String args[]) throws CancelaDAOException {
/*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.
* F... |
2b53541d-b267-4da5-9570-65796594a3f4 | 7 | public void scanForSpeech(byte[] dataBuffer) {
ByteArrayOutputStream speechData = new ByteArrayOutputStream();
boolean isSpeech = false;
int tailIndex = 0;
for (int headIndex = 79; headIndex < dataBuffer.length; headIndex= headIndex+80) {
// process this segment
byte[] currentBuffer = Arrays.copyOfRange(d... |
377e3e94-3b86-41b5-a7d1-4cc381b71dd6 | 7 | public static String showResults(int num) throws Exception {
FileOutputStream outputStream = new FileOutputStream(OUTPUT_FILE);
PrintStream outputFileWriter = new PrintStream(outputStream);
Set<String> keys = words.keySet();
ArrayList<WordFreqPair> rankedWords = new ArrayList<WordFreqP... |
9fb055ea-1030-4bc2-8caa-6abd1dd92e49 | 5 | public void paint(Graphics2D g) {
g.setFont(getFont());
if (textUpdated) {
strWidth = g.getFontMetrics().stringWidth(getText());
textUpdated = false;
if (autoResize) {
this.width = strWidth+13;
this.height = (int)(getFont().getSize() * 1.5f)+3;
createBuffer(true);
bufferNeedsIntemediatePain... |
0bafe54c-a58e-40b5-aca0-893ab081ef50 | 0 | public float getHPRatio() {
return (float) hp / maxHP;
} |
51bf3133-c977-4376-abea-6633bee1bfe1 | 9 | public void receive(SmashClientHost client, String line) {
int index = 0;
for(; index < players-1; index++){
if(client.equals(clients[index]))
break;
}
if(line.startsWith(FILE_START_SKIN)){
String name = TEMP_FOLDER_PATH+client.getName()+".sskin";
FileTools.saveFromInput(new File(name), client.getI... |
0d721a0f-5ed8-435f-80c2-a7ba64c951bb | 2 | public String state() {
if (is("filled"))
return "grow";
else if (events.contains("food"))
return "eat";
else
return "move";
} |
c7f17d7c-90e2-482a-b5ae-828a74a1fe36 | 1 | private void initForm()
{
SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
}
});
// Basic form properties
this.setTitle("Card Counter Training");
this.setVisible(true);
this.setDefaultCloseOperation(JFrame.... |
edbc9a4d-4476-481c-a55e-084b03c2910a | 7 | public void actionPerformed(ActionEvent e) {
Object obj = e.getSource();
Field field = mainpanel.field;
if(obj == one_step_button){//一世代ずつ進める
if(!spending_time)
field.nextTime();
}
if(obj == time_step_button){//時間を流す
if(time_step_button.isSelected()){
time_step_button.setText("Stop");
spendi... |
3bf9f83d-8f72-4e32-bf7d-dbcbc35b7910 | 7 | public static void save() {
if (!ColorKeys.economyEnabled)
return;
if (CODKeys.values().size() == 0) { //If queue is empty OR economy is disabled.
QueueFile.delete();
return;
}
ColorKeys.Log(Level.INFO, "Saving COD queue...");
try {
if (!QueueFile.exists()) {
if (!QueueFile.createNewFile()... |
e28cf282-341d-471e-8de6-823c51c18f9e | 4 | private void swapEnHauteur() {
Vertex vtemp;
if (v2.v_proj.y > v1.v_proj.y) {
vtemp = v1;
v1 = v2;
v2 = vtemp;
}
if (v3.v_proj.y > v1.v_proj.y) {
vtemp = v1;
v1 = v3;
v3 = vtemp;
}
if (v3.v_proj.y > v... |
c326d8b5-29bf-4c65-9317-a28277dfbbfc | 3 | public Node getNode(int x, int y) {
for(Node unNode : mesNodes){
if(unNode.getX() == x && unNode.getY() == y){
return unNode;
}
}
return null;
} |
b864ce00-86e6-48c1-9780-e14889e28678 | 3 | private static InfoflowResults runAnalysis(final String fileName, final String androidJar) {
try {
final long beforeRun = System.nanoTime();
final SetupApplication app = new SetupApplication(androidJar, fileName);
app.setStopAfterFirstFlow(stopAfterFirstFlow);
app.setEnableImplicitFlows(implicitFlow... |
0e7448d8-5ebb-48f0-a623-a8be227ff81e | 4 | public int min(int hori, int verti, int dia) {
if (hori <= verti && hori <= dia) {
return hori;
} else if (verti <= hori && verti <= dia) {
return verti;
} else {
return dia;
}
} |
063ce048-c77a-4763-a4a9-fa1ea10acacd | 1 | @Test
public void testAddToStart() throws Exception{
List<String> list = new List<>();
list.addToStart("test1");
list.addToStart("test2");
list.addToStart("test3");
for (String current : list) {
assertTrue(list.exist(current));
}
} |
a0d65739-b57d-444e-a481-ffbfd60d457a | 9 | public void action() {
if (coords.equals(maze.getEnd())) {
isAtEnd = true;
isMoving = false;
} else if (isMoving) {
move(facing, false);
if (isTurning) {
if (((coords.x % tileSize) == 0)
&& ((coords.y % tileSize) == 0)) {
isTurning = false;
facing = nextFacing;
}
} else if (is... |
7927c8d5-a370-433c-a553-97bd3c99125b | 0 | public boolean isMovingUp() {
return isMovingUp;
} |
347ffb76-a4dd-40c4-8400-4c900f3f4b47 | 4 | public static BigInteger getPrimeMultiples(int n, int B) {
BigInteger result = ONE;
for (int num = 2; num < B; ++num) {
boolean isPrime = true;
for (int i = 2; i < num; ++i) {
if ((num % i) == 0) {
isPrime = false;
break;
}
}
if (isPrime) {
// multiply result by num^n
BigIn... |
b228121d-f16c-4f3c-8b5e-1be749cc7288 | 9 | static void movePlayer(ShipsMaping Statek, int x, int y, int z, World swiat)
{
List<Player> gracze = swiat.getPlayers();
for (int a = 0; gracze.size() > a; a++)
{
Player player = (Player)gracze.get(a);
int X = player.getLocation().getBlock().getRelative(0, 0, 0).getX();
if(EntityDebug) {... |
b3caffa5-60ce-41ab-9b2a-09bc83ffb184 | 5 | public boolean separatedByAxis(Vector axis3, Poly poly1, Poly poly) {
float mina, maxa;
float minb, maxb;
calculateInterval(axis3, poly1);
mina = poly1.getMin();
maxa = poly1.getMax();
calculateInterval(axis3, poly);
minb = poly.getMin();
maxb = poly.getMax();
double d0 = maxb - mina;
double d1 = m... |
37715049-2d95-413a-ad1e-dd9153ab66d1 | 6 | public static VersionCheck version(String software, String latestVersion, String url, boolean verbose) {
//---
// Create logStats & add data
//---
VersionCheck versionCheck = new VersionCheck(software, latestVersion, url);
//---
// Run thread
//---
versionCheck.start();
// Finish up
if (verbose) ... |
8bf393ae-4de7-4d7b-b8f0-6e6efd60a75a | 6 | public void update()
{
if(lblXpos != null)
lblXpos.setText(Float.toString(objForInfo.getTransform().getPosition().getX()));
if(lblYpos != null)
lblYpos.setText(Float.toString(objForInfo.getTransform().getPosition().getY()));
if(lblZpos != null)
lblZpos.setText(Float.toString(objForInfo.getTransform().ge... |
58e21653-1884-44df-a64a-ae46240e7789 | 9 | private void begin() {
Scanner scn = new Scanner(System.in);
int length = scn.nextInt();
while ( length != 0 ) {
int qtCuts = scn.nextInt();
int cuts[] = new int[qtCuts+2];
cuts[0] = 0;
cuts[qtCuts+1] = length;
for ( int c = 1; c <= qtCuts; c++ ) {
cuts[c] = scn.nextInt();
}
int table... |
a6d688f6-77ba-4fc5-a284-7e606726b698 | 7 | public boolean isValidDate(){
String date = getDate();
if(date.length()<10 || (!(!isValidNum(date.substring(0, 4)) && !isValidNum(date.substring(5,7)) && !isValidNum(date.substring(8,10))) && (!isValidNum(date.substring(0, 4)) || !isValidNum(date.substring(5,7)) || !isValidNum(date.substring(8,10)))))
return fal... |
e2da957a-235f-4cbf-ab62-b065971403b9 | 2 | public void tick() {
time += 2;
if (time == 30) game.changeLevel(dir);
if (time == 60) game.setMenu(null);
} |
ef15729b-3528-44d6-82c8-e4619844e4f2 | 3 | public String generateRandomFarg()
{
int fargCode = new Random().nextInt(3);
String farg = null;
switch(fargCode)
{
case 0:
farg = "röd";
break;
case 1:
farg = "blå";
break;
case 2:
farg = "gul";
break;
default:
farg = null;
break;
}
return farg;
} |
b7629b1e-e856-41ca-84a5-588c000c8f74 | 7 | @Override
public boolean equals(Object obj) {
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
final Vehiculo other = (Vehiculo) obj;
if (!Objects.equals(this.matricula, other.matricula)) {
retu... |
64834ab4-bd61-409d-8d27-4824d6f29cfa | 6 | public void init(){
for(int i=0;i<height;++i)
for(int j=0;j<width;++j){
if(j-1>=0) matrix[i][j] += matrix[i][j-1];
}
for(int i=0;i<height;++i)
for(int j=0;j<width;++j){
if(i-1>=0) matrix[i][j] += matrix[i-1][j];
}
} |
ad84107c-e1f8-4f4c-8f78-da8fd3579d3f | 0 | public CheckResultMessage check18(int day) {
return checkReport.check18(day);
} |
93cf5193-22b1-4854-ab89-f624534bf290 | 7 | public static DefaultTableModel getTableModel(Date date){
Vector<Object> orders = new Vector<Object>(); // to return
Vector<Object> orderRow = new Vector<Object>(); // a row
Vector<Object> columns = new Vector<Object>(); // columns
log.info("getting order table model");
try {
Connection conn = DBConn... |
3efd76d8-e913-4408-88bd-b07b1e0b8150 | 5 | private List<Tweet> processTweetData(List<Twitter> twitterTweetData) throws ParseException {
// TODO Auto-generated method stub
List<Tweet> list=new ArrayList<Tweet>();
try {
for (Twitter twitter : twitterTweetData) {
if(twitter.getData() != null)
{
JSONObject tweetJson=new JSONObject(twitter.getD... |
015b40f3-b2bb-48d5-aa49-a83694d9f579 | 0 | private boolean fireServerExceptionEvent(ExceptionEvent evt) {
logger.debug(getName() + ".fireServerExceptionEvent: " + evt.getException().getMessage());
return true;
} |
5325e74e-aaba-4a40-91d1-6d160de11314 | 4 | public void describeBehaviour(Description d) {
if (type == TYPE_WANDERING) {
d.append("Wandering") ;
}
if (type == TYPE_SECURITY) {
d.append("Securing perimeter for ") ;
d.append(guarded) ;
}
if (type == TYPE_STREET_PATROL || type == TYPE_SENTRY_DUTY) {
d.append("Patrolling b... |
fe181f3e-bc6a-4d3f-9430-8c0afdd8dd55 | 2 | static int numberDivider(double y){
double givenNumber=y;
int dividerMax=(int) Math.sqrt(givenNumber);
int divider=1;
for(int i=1; i<=dividerMax; i++){
if(givenNumber%i==0){
divider++;
}
}
return divider;
} |
09ba6188-c232-4c62-a170-fcbfcb95a52f | 6 | public void cut(SimpleFrame panelText)
{
panelText.setAction(false);
int cp;
if (panelText.getText().getSelectedText() != null)
{
copy(panelText);
cp = panelText.getText().getSelectionStart();
try
{
String text = panelText.getText().getSelectedText();
int position = panelText.getText().get... |
f6b94340-b97b-4119-bd51-a1f1e4801889 | 2 | public static ArrayList<QuizTakenRecord> getQuizHistoryByQuizID(int quizID, Timestamp time) {
ArrayList<QuizTakenRecord> records = new ArrayList<QuizTakenRecord>();
String statement = new String("SELECT * FROM " + DBTable + " WHERE qid = ? AND time > ?");
PreparedStatement stmt;
try {
stmt = DBConnection.con... |
9405d00f-4ecc-4d3b-804b-64e426b702fd | 2 | public void run() {
while (!global.quit) {
state.update();
try {
Thread.sleep(5); // update every 5ms
} catch (InterruptedException e) {
e.printStackTrace();
}
}
} |
269d1735-66fb-4402-a674-32da76a79530 | 6 | public AdvancedRotator(int num_bits, boolean is_left) {
super(null);
bitness = num_bits;
int num_ctrls = (int)Math.ceil(Math.log(num_bits+0.1)/Math.log(2));
inNOPs = new NOPNode[num_bits];
ctrlNOPs = new NOPNode[num_ctrls];
rotators = new Rotator[num_ctrls];
muxs = new MultiMux[num_ctrls];
for (int i = ... |
a9113db0-7eee-49c8-85df-b21876a56873 | 9 | public Mazewar(int serverPort, String serverName, int listenPort) {
super("ECE419 Mazewar");
consolePrintLn("ECE419 Mazewar started!");
// Set up globals for server communication
this.serverName = serverName;
this.serverPort = serverPort;
// ... |
12d7b08a-d293-4ee2-a8d0-8dc9be6377c3 | 5 | public boolean needUppdate(int score1, int score2, int lives1, int lives2, Gun wep1, Gun wep2) {
return this.score1 != score1 || this.score2 != score2 || this.lives1 != lives1 || this.lives2 != lives2 || this.wep1 != wep1 || this.wep2 != wep2;
} |
888b6d1f-c93d-49b6-9e25-e65b3eba53cc | 1 | protected void paintContentBorderTopEdge(Graphics g, int tabPlacement, int selectedIndex, int x, int y, int w, int h) {
Rectangle selectedRect = selectedIndex < 0 ? null : getTabBounds(selectedIndex, calcRect);
g.setColor(darkShadow);
g.drawLine(x, y, selectedRect.x - (selectedRect.height / 4), ... |
794d721e-e60f-4c50-b805-86cd2dd8a4f5 | 0 | public void setItemName(String value) {
this.itemName = value;
} |
08c06a21-276f-42a3-a0cd-c524641f20c6 | 1 | public void reserveSmallConstants(GrowableConstantPool gcp) {
if (bytecode != null)
bytecode.reserveSmallConstants(gcp);
} |
4908f344-3251-4d4f-be24-0617d38e9a65 | 3 | public void actionPerformed(ActionEvent event)
{
BoutonPerso itemSelectionne = (BoutonPerso) event.getSource();
if (itemSelectionne.getClass() == new BoutonArcher(null).getClass())
{
System.out.println("archer selectionne");
}
if (itemSelectionne.getClass() == new BoutonMage(null).getClass())
{
Syste... |
76fe8e2b-7e8e-4931-bc01-28a91de501be | 0 | public Labo() {
} |
5d0658ac-a4da-4ee6-8fd6-929a1c842917 | 2 | public int GetNumber() {
int num = 0;
for (int i=0; i<m_colourMap.length; i++) {
if (!(m_colourMap[i].equals(null))) {
num++;
}
}
return(num);
} |
b8ae3741-d082-46ab-a7d3-e7829333107f | 5 | private long
getNumberFromStream(
BDecoderInputStream dbis,
char parseChar)
throws IOException
{
final char[] chars = new char[32];
int tempByte = dbis.read();
int pos = 0;
while ((tempByte != parseChar) && (tempByte >= 0)) {
chars[pos++] = (char)tempByte;
if ( pos == chars.length ){... |
5f7463b4-e924-418f-a928-85975a52a5da | 0 | public DataIn(AlgorythmFile algorythmFile, DataStructures arrData, int numberOfPoints){
this.algorythmFile = algorythmFile;
this.arrData = arrData;
this.numberOfPoints = numberOfPoints;
} |
d8124bab-0306-42fe-a7e0-4183317b4d8b | 0 | public void setMax(int upperBound) {
this.upperBound = upperBound;
} |
709a8905-b445-4aee-9455-c975306674e9 | 8 | public Object clone()
{
XMLResourceSpec xmlresourcespec = new XMLResourceSpec();
xmlresourcespec.description = description != null ? new String(description) : null;
xmlresourcespec.path = path != null ? new String(path) : null;
xmlresourcespec.root = root != null ? new String(root) :... |
e7555179-1bf6-49ab-bae4-fbbd39a73083 | 6 | public boolean doSave(boolean saveAs)
{
File f = file;
if (saveAs || file == null)
{
f = getFile(true);
if (f == null) return false;
// just use PNG..
String name = f.getName().toLowerCase();
if (!name.endsWith(".png"))
{
if (name.contains(".")) name = name.substring(0,name.lastIndexOf('... |
5684d596-2dcb-468f-a529-948878d501f3 | 1 | public String dealWith(Long testObject) {
if (testObject > 10) {
return "大于10跳出!";
}
return handler.dealWith(testObject);
} |
46e50b6b-0dac-4e3a-969f-d643a6988acb | 6 | @Override
public void controlObject(GObject target, Context context) {
super.controlObject(target, context);
final double tx = target.getX();
final double ty = target.getY();
final double iw = target.getWidth() / SIDE_LENGTH;
final double ih = target.getHeight() / SIDE_LENGTH;
final do... |
1c0835f5-1d15-4f10-9e8b-7910c0ccb273 | 5 | public static ModeleListeJoueurJeuMastermind getInstance(boolean isNewInstance, boolean razJoueurs)
{
if (instance == null)
{
instance = new ModeleListeJoueurJeuMastermind();
}
if (isNewInstance == true)
{
Set<String> listejoueurs = null;
if (razJoueurs == false)
{
listejoueurs = instance.... |
0ddb32e0-4241-4525-bbfb-dedc6bcfd541 | 8 | @Override
public boolean execute(CommandSender sender, String[] args) {
if(!(sender instanceof Player)) {
return true;
}
String username = sender.getName();
String name = args[0];
Group group = groupManager.getGroupByName(name);
if(group == null) {
sender.sendMessage("Group doesn't exist");
re... |
34c0dcdb-e635-43e8-bb6d-bf14de18807f | 1 | public void print() {
Node n = this;
System.out.print(n.data + " ");
while(n.next != null) {
n = n.next;
System.out.print(n.data + " ");
}
System.out.println();
} |
1fbc5eae-6422-4bc5-8740-02568a81f056 | 5 | public void inicio() {
System.out.println("ENTROU");
if (!acabouListaTokens()) {
nextToken();
if (tipoDoToken[0].equals("Palavra Reservada")) {
if (tipoDoToken[1].equals(" registro")) {
this.analisaRegistro();
} else if (tipoDoT... |
322f8303-51aa-46aa-a80e-baec105820e4 | 0 | @Test
@TestLink(externalId = "T2_WITHOUT_MESSAGE")
public void testFailedWithOutMessage() {
assertTrue(false);
} |
82d0e425-5fb5-4e2f-9fb6-d32822df986a | 3 | @SuppressWarnings("unchecked")
public String getOverviewTable() {
PreparedStatement st = null;
ResultSet rs = null;
JSONArray json = new JSONArray();
try {
conn = dbconn.getConnection();
st = conn.prepareStatement("SELECT team_id, sum(auton_top)*6 + sum(auton_... |
0f2b7b0b-2448-45fe-80c7-8cc0dc0dead9 | 2 | public Grille (EnvironnementAbs env){
super(env);
Border blackline = BorderFactory.createLineBorder(Color.black,1);
for(int i= 0 ; i < env.taille_envi;i++){
for(int j= 0 ; j < env.taille_envi;j++){
agent[i][j].setBorder(blackline);
}
}
pan.setBorder(blackline);
} |
03dfa490-b8e1-483d-a9b5-76293c45a5dd | 7 | public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer)
{
MovingObjectPosition var4 = this.getMovingObjectPositionFromPlayer(par2World, par3EntityPlayer, true);
if (var4 == null)
{
return par1ItemStack;
}
else
... |
5d93256b-279d-4137-ba27-9001c64133bb | 0 | public String toString() {
return buffer.toString();
} |
d3f56467-b7fa-4fb7-827b-e7d4c85c9027 | 7 | private void loadClientOptions(File savedGame) {
clientOptions = new ClientOptions();
logger.info("Loaded default client options.");
if (actionManager != null) {
clientOptions.add(actionManager);
logger.info("Loaded client options from the action manager.");
}
... |
d6a17520-f8cf-4dfe-a637-9fa597ce5ef0 | 2 | public Part getPart() {
double t = nextRand();
if ( t < 0.4)
return Part.PUBLIC;
else if ( t < 0.9 )
return Part.SPECIALIST;
else
return Part.URGANCE;
} |
c5644e70-b868-4cea-8c78-3bad1571962a | 6 | int endGoalCount(int col){
int count = 0;
if (col == Chip.WHITE) {
for (int i = 1; i<7; i++) {
if(board[7][i].returnColor() == Chip.WHITE)
count++;
}
}
if (col == Chip.BLACK) {
for (int i = 1; i<7; i++) {
if(board[i][7].returnColor() == Chip.BLACK)
c... |
9b31a42c-d3a6-45b6-94a8-b698b2093192 | 8 | int divide(int a, int b) throws Exception {
if (b == 0)
throw new Exception("Divisor shouldn't be zero!");
boolean negative = false; // Sign
if (a < 0) {
negative = !negative;
a = sub(0, a);
}
if (b < 0) {
negative = !negative;
b = sub(0, b);
}
int MAX = Integer.MAX_VALUE >> 1;
int tmp = ... |
b28ab072-0183-4861-8c02-8dd22c31fd7c | 4 | public static Image getRandomWebcomic(Webcomic webcomic) {
Image image = null;
try {
URI uri = new URI(webcomic.getScheme(), webcomic.getHost(),
webcomic.getPath(), webcomic.getFragment());
BufferedReader reader = new BufferedReader(new InputStreamReader(
uri.toURL().openStream()));
String p... |
9954ee37-8cdf-4c18-bc43-b51703287ce9 | 8 | private void setParamStatement(PreparedStatement stmt)
throws SQLException {
int i=1;
for (Map.Entry<String, Object> e : parameters.entrySet()) {
if(i==1) logger.debug("[guteDAO] Parametters:");
String key = e.getKey();
Object value = e.getValue();
if(value instanceof String){
stmt.se... |
c40b9414-3a23-4bb5-9a3a-3b67dab9a6ec | 8 | private boolean checkToSetCodedContent(Element in, Element out, String fieldToSet) {
// first look for coded content
CodedContentCollection collector = new CodedContentCollection();
// String codedID = in.getAttribute("name");
if (in.getAttribute("radlex:id") != null && in.getAttribute("rad... |
7186f12f-36df-4642-b339-cf7b48bb53e8 | 2 | private void createListSubtasks(ResultSet result){
try{
while(result.next()){
Subtask subtask = new Subtask();
subtask.setName( result.getString("podukol") );
subtask.setDate( result.getString("datum") );
s... |
d386249a-8a68-45ed-b040-74c127509687 | 4 | private void updateStateTool(List<Keyword> keywords, List<String> terms) {
// TODO mehr als ein tool durch terms
RecipeLearningState nextState;
List<Keyword> tools = keywordsFromType(KeywordType.TOOL, keywords);
if (userSaidEnd(keywords)) {
nextState = new RecipeLearningState(RecipeLearning.RL_ASK_FIRST_STEP);
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.