method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
3a429f5e-1a3d-4503-941b-b6775c012776 | 5 | public static void main(String[] args) {
final int NOMBRE = 5;
findNumero();
String numero;
int i;
int j;
for(i = 0; i < NOMBRE; i++) {
numero = genNumero();
for(j = 0; j < TAILLE; j++) {
System.out.print(numero.charAt(j));
if(j == 2 || j == 5)
System.out.print(" ");
}
Sy... |
6e512b39-845c-4c75-a5c8-801c61d44d2b | 4 | public void framerateManager()
{
if( lastFPS <=System.currentTimeMillis() )
{
fps=""+frames;
//System.out.println(fps);
lastFPS = System.currentTimeMillis() + 1000;
if(frames<80&&slp>0)
slp--;
else if(frames>110)
slp++;
frames=0;
}
} |
9e6f9e00-6071-4e36-8f4c-df10c33bac04 | 6 | @Override
public int compareTo(PacketEntry that) {
// compare type first
if (this.underlyingPacket.getPacketType().getTypePriority() > that.underlyingPacket
.getPacketType().getTypePriority()) {
return -1;
} else if (this.underlyingPacket.getPacketType().getTypePriority() < that.underlyingPacket
... |
1305c84f-0b4a-4766-babd-054c2891a904 | 5 | public static void decode(final String password, final String codeImagePath, final boolean useOTP, final String otpImagePath, final IDECoderInterface coderInterface) {
Thread t = new Thread() {
@Override
public void run() {
byte[] data = null;
String erro... |
077dc0a8-ebbb-4771-8679-f8f2effacb5a | 2 | public void padr()
{
if (("MI").indexOf(ftype)>=0) {/*do nothing */}
else if (("CLD").indexOf(ftype)>=0) addc(false," ");
else addc(false,"\0");
} |
847592d6-6b2e-47ba-a70c-792e7748df5d | 9 | @Override
public Object execute(Object obj, Object[] args) {
// 获取Mongo查询中需要用到的查询shell和参数
Method[] getterMethods = definition.getGetterMethods();
Integer[] parameterIndexes = definition.getParameterIndexes();
BeanMapper<?> beanMapper = definition.getBeanMapper();
int batchSize = definition.getBatchSize();
... |
6f834f57-c0a1-4647-a4c5-0a72ab59ee4d | 2 | public void insertDates() throws ParseException{
// http://docs.oracle.com/javase/tutorial/essential/io/file.html
// http://docs.oracle.com/javase/tutorial/java/data/manipstrings.html
//
Path file = Paths.get("/home/mark/0-prj/bible/bookchap-v3.csv");
Charse... |
5122aa8a-9c62-4f9f-92f7-ab5b0d0132fc | 9 | public void applyPositionChange(Vector3d[] linearChange,
Vector3d[] angularChange, double max) {
double[] angularMove = new double[2];
double[] linearMove = new double[2];
double totalInertia = 0.0d;
double[] linearInertia = new double[2];
double[] angularInertia = new double[2];
for (int i =... |
e56f9ca0-978a-4fe1-a516-b25884bccc7c | 3 | public static String getMaxCategoryID(){
try {
ResultSet rs=DB.myConnection().createStatement().executeQuery("select max(CategoryID) from category");
while(rs.next()){
max_category_id=Integer.toString(rs.getInt(1)+1);
}
} c... |
5a9bb9d4-0f88-4e76-a1f8-d40384451700 | 7 | private void calculate_amplitude() {
int envelope_volume, tremolo_volume, amplitude;
int envelope_panning, mixer_panning, panning_range;
Envelope envelope;
envelope_volume = 0;
if( instrument.volume_envelope_active ) {
envelope = instrument.get_volume_envelope();
envelope_volume = envelope.calculate_amp... |
c09f268d-8944-420d-ac58-e92b46119137 | 8 | public void visit_astore(final Instruction inst) {
final int index = ((LocalVariable) inst.operand()).index();
if (index + 1 > maxLocals) {
maxLocals = index + 1;
}
if (inst.useSlow()) {
if (index < 256) {
addOpcode(Opcode.opc_astore);
addByte(index);
} else {
addOpcode(Opcode.opc_wide);
... |
f47386d6-21cd-41c6-8d20-7d48a62b1407 | 9 | public void roll(int pinDown) {
System.out.println(currentFrame + "프레임 " + currentRoll + "번째 투구");
System.out.println("공을 굴립니다! 데구르르르....");
totalRoll++;
currentPin = currentPin - pinDown;
System.out.println(pinDown + "핀을 쳤습니다!");
if (currentRoll == 1 && pinDown == 10) {
System.out.println("대단해요! 스트라이크... |
fc25ec4a-b476-4860-a9f0-bac4406efb80 | 4 | @SuppressWarnings("unchecked")
@Override
public String displayQuestionWithAnswer(int position, Object userAnswer) {
String questionStr = (String) question;
ArrayList<String> answerList = (ArrayList<String>) answer;
String userAnswerStr = (String) userAnswer;
boolean correct = false;
if (getScore(userAnswer)... |
4a944b86-2ea5-469b-846e-0d6554efd9e7 | 1 | public static List<String> getStrings() {
ArrayList<String> strings = new ArrayList<>();
for (DataType dataType : DataType.values()) {
strings.add(dataType.toString());
}
return strings;
} |
d1d06979-8251-4e6b-ac08-1a301fec13bd | 5 | public int neighbors(){
// Requires indexes of array
int countLiveNeighbors = 0;
for (int offsetY = -1; offsetY <= 1; offsetY++){
for(int offsetX = -1; offsetX <= 1; offsetX++){
if (0 != offsetX || 0 != offsetY) {
int altRow = mod(positionY+offsetY, this.height);
int altCol = mod(positionX+offset... |
47b6b393-47f1-413e-8b37-6c0628c99273 | 9 | public String run(File f) throws IOException, JAXBException{
if(isUniconvertoInstalled() && isImageMagickInstalled()){
List<String> command = new ArrayList<String>(Arrays.asList("identify", "-verbose",f.getPath()));
String identifyOutput = CommandLine.exec(command, null);
Result res = new Result();
re... |
b56f3c93-e561-4234-83c0-1341c191a506 | 9 | public boolean blockCheck() {
for (int k = 0; k < blockX.size(); k++) {
for (int i = 0; i < cb.length; i++) {
for (int j = 0; j < cb.length; j++) {
if (cb[i][j] % 2 != 0 && cb[i][j] != 0) {
if (checkBlackAttack(cb, cb[i][j], j, ... |
31a286c0-0ff3-47a3-9a83-d25f62cb405d | 2 | @OnLoad
public void onLoad() {
UserModel user = DataStore.getUser(getParis_userId());
if(user!=null) this.paris_user = user;
ScheduleModel sched = DataStore.getSchedule(getParis_schedId());
if(sched!=null) this.paris_sched = sched;
} |
65cb7060-4808-44d3-93b3-2ca68862abb1 | 7 | @Override
public void run(){
Exception invocationError = null;
setResponse(null);
try {
if (false) throw new Exception("");
// It's a synchronized sectiondue the fact is not guaranteed that the proxy object
// ... |
78539b48-a43b-4b73-b98f-6943f68df7f2 | 3 | public static String[][] getLinks(String webpage) throws IOException, BadLocationException {
doc = new HTMLDocument();
InputStream in = new URL(webpage).openConnection().getInputStream();
InputStreamReader reader = new InputStreamReader(in,"ISO-8859-1");
String[][] matrix = new String[50][50];
int i = 0;
... |
b48669a6-d050-40e0-97f8-c5fc00c6f50b | 0 | public void setPrice(float price) {
this.price = price;
} |
45191e11-8dc1-4bb2-be5f-d9bcaba786a0 | 7 | @Override
public void init() {
/*
* 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. Fo... |
1aabad8b-49f9-45f4-9e58-c331a9574861 | 8 | public void visitBaseType(final char descriptor) {
switch (descriptor) {
case 'V':
declaration.append("void");
break;
case 'B':
declaration.append("byte");
break;
case 'J':
declaration.append("lon... |
6ec474af-f0e9-4869-8f9c-c7724bc5a36d | 3 | public void disableServiceMode(Player player)
{
if(null != player)
{
if(playersInSM.contains(player.getName()))
{
playersInSM.remove(player.getName());
if(player.isOnline())
{
player.sendMessage(ChatColor.RED + "Service-Modus AUS");
... |
cc3af1e3-648b-4584-9af9-15672c40aeff | 1 | private static void displaySchedules(ResultSet rs)throws SQLException{
StringBuffer bf = new StringBuffer();
while (rs.next()){
bf.append(rs.getDate("work_day")+", ");
bf.append(rs.getTime("work_from")+", ");
bf.append(rs.getTime("work_till")+", ");
bf.append(rs.getBigDecimal("hourly_rate")+", ");
... |
4534a19c-1769-457b-98d3-2a6f1180c647 | 0 | private void loginPage(){
loginPane = new JPanel();
loginPane.setBackground(SystemColor.activeCaption);
loginPane.setLayout(null);
//Title Image, CareMRS
ImageIcon image_title;
JLabel label1;
image_title = new ImageIcon(getClass().getResource("CareMRS.png"));
label1 = new JLabel(image_title);
label... |
6d37f07f-36b2-416d-bad3-692bcdceeacb | 5 | private void setData( TLanguageFile langFile, TProject pProject )
{
project = pProject ;
if ( langFile != null )
{
mode = EDIT_MODE ;
filenameField.setText( langFile.getFileName() ) ;
String dummy = langFile.getLanguageCode() ;
if ( ( dummy != null ) && ( dummy.length() > 0 ) )
... |
04ad9727-2b68-4767-b737-15c2b97225d7 | 3 | public void draw() {
Graphics.setColour(192, 192, 255);
for (int i = 0; i < body.size(); i ++) {
Cell c = body.get(i);
if (i >= bullets) Graphics.setColour(255, 255, 255);
Graphics.rectangle(true, c.x * Map.TILE_SIZE, c.y * Map.TILE_SIZE, Map.TILE_SIZE, Map.TILE_SIZE);
}
for (Pellet p : pelletsEating) ... |
68aa29df-42b9-46d3-b8e5-a04563d66d94 | 5 | @EventHandler
public void onPlayerQuit(PlayerQuitEvent event){
final Player p = event.getPlayer();
final String pname = p.getName();
if(plugin.getArena(p)!= null){
a = plugin.getArena(p);
plugin.Out.get(a).add(pname);
plugin.Playing.get(a).remove(pname);
plugin.getServer().getScheduler().scheduleSync... |
2ed63384-5318-4ed1-a9b4-eca143184e2a | 9 | public final void setTeacher(final Unit newTeacher) {
Unit oldTeacher = this.teacher;
if(newTeacher == oldTeacher){
return;
}
if (newTeacher == null) {
this.teacher = null;
if(oldTeacher != null && oldTeacher.getStudent() == this){
old... |
075caccf-5e5a-4038-9b06-22eb6437ddbe | 3 | public void paintComponent(Graphics g) {
setScale(); //makes the grid scale according to panel size
if(!background) {
g.drawImage(Player.getImage(), 25, 35, (cellWidth+1)*this.width+1, (cellHeight+1)*this.height+1, null);
background = trace;
}
g.setColor(Color.CYAN);
drawCells(g);
if(gui.getLose()) {... |
5004434c-5084-463b-a04b-d0f16772977f | 1 | public void loadUsers(){
table=new DefaultTableModel();
table.addColumn("Usuarios");
table.addColumn("Contraseñas");
this.tableUsers.setModel(table);
String[][] user=con.leerDatos("usuarios","user,pass", null);
for(int i=0;i<user.length;i++){
String[] data=new... |
7e8dd95d-c1f5-4409-ada1-d114b74569cc | 1 | public void setPWResetFonttype(Fonttype fonttype) {
if (fonttype == null) {
this.pwResetFontType = UIFontInits.PWRESET.getType();
} else {
this.pwResetFontType = fonttype;
}
somethingChanged();
} |
c60554a5-cd75-4dc9-bf83-4a1ca335431c | 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... |
bf9c8b76-e9cd-4f8a-ae8b-a44fea72de6f | 8 | public String alignment(ErrorStream obostream) {
String str = "";
int i = 0;
for(WeightedError err : obostream) {
if (err.max() != null && i < size()) {
if(!(ignore_noerr && (err.max().getType() == ErrorTypes.UNC_NO_ERR ||
err.max().getType() == ErrorTypes.OBO_NOERR))) {
if (err.max().getIs() == ge... |
1e15fb2e-40e2-4169-a568-4891dd567e7e | 9 | public void loadConfig(String config)
throws IOException
{
Properties properties = new Properties();
Resource resource=Resource.newResource(config);
properties.load(resource.getInputStream());
_jdbcDriver = properties.getProperty("jdbcdriver");
_url = propert... |
c4b1683f-6529-4028-9717-3199ed12e7e0 | 7 | public static void main(String[] args) throws FileNotFoundException, IOException {
if(args.length < 2){
System.out.println("One or more argument(s) missing.");
System.out.println("EXAMPLE: java -jar JCEPIT.jar -R RabinExampleAutomata.txt");
System.out.println("EXAMPLE: java -jar JCEPIT.jar -B BuchiExample... |
a9bd4b9c-1ed2-4e61-b826-b43767fc9af3 | 7 | public void setOptions(String[] options) throws Exception {
String tableString, inputString, tmpStr;
resetOptions();
tmpStr = Utils.getOption("url", options);
if (tmpStr.length() != 0)
setUrl(tmpStr);
tmpStr = Utils.getOption("user", options);
if (tmpStr.length() != 0)
... |
650d0ab0-04c3-448a-b350-7a5ead53ee5b | 4 | public static BufferedImage setBlackAndWhiteNonStrict(BufferedImage img) {
for (int i = 0; i < img.getWidth() - 1; i++) {
for (int j = 0; j < img.getHeight() - 1; j++) {
if (img.getRGB(i, j) != -1 && img.getRGB(i, j) != -16777216) {
img.setRGB(i, j, -1);
}
}
}
return img;
} |
766108be-6cdd-4dda-b6f1-3be7a326aaf6 | 1 | public void actionPerformed(ActionEvent ae) {
if (((MenuItem)ae.getSource()).equals(aboutMenuItem)) {
textArea.setText(aboutText());
setVisible(true);
} else {
textArea.setText(helpText());
setVisible(true);
}
} |
801aadf7-e5fb-43d2-9633-95af5716bdff | 5 | public void drawNode(Graphics g) {
g.setColor(Color.BLACK);
if (start) {
// if user denotes node to be start
g.setColor(Color.RED);
g.fillRect(x, y, w, w);
} else if (dest) {
//user denoted destination
g.setColor(Color.BLUE);
g.fillRect(x, y, w, w);
} else if (inPath) {
//A* denotes part of... |
33a69e0e-43c8-40d8-9ed4-aafd02ba4a9e | 4 | @Override
public void collide(Entity entity) {
if(entity instanceof Hero) {
Hero hero = (Hero)entity;
if(!hero.getTeam().equals(owner)) {
capture(hero.getTeam());
}
} else if(entity instanceof Explosion) {
if(entity != lastExplosion) {
takeDamage();
lastExplosion = (Explosion)entity;
}
... |
fca3f20a-f311-4e56-a686-26abb9d7c9c4 | 1 | private DalcPlaylist() {
try {
mConnection = DBConnection.getConnection();
} catch (SQLServerException ex) {
}
} |
8e78e865-4e65-4b4c-8b48-6ef15d6f495f | 3 | private static void blankField(Class<?> enumClass, String fieldName) throws Exception
{
for (final Field field : Class.class.getDeclaredFields())
if (field.getName().contains(fieldName))
{
field.setAccessible(true);
setFailsafeFieldValue(field, enumClass, null);
break;
}
} |
0829cb0a-570e-470f-9e27-1abbe637213d | 6 | @EventHandler
public void GiantPoison(EntityDamageByEntityEvent event) {
Entity e = event.getEntity();
Entity damager = event.getDamager();
String world = e.getWorld().getName();
boolean dodged = false;
Random random = new Random();
double randomChance = plugin.getGiantConfig().getDouble("Giant.Poison.Dodg... |
7e7003b8-6e5b-4965-be97-be0d6ab3f184 | 7 | @Override
public boolean equals(final Object o) {
if (this == o) {
return true;
}
if (!(o instanceof Type)) {
return false;
}
Type t = (Type) o;
if (sort != t.sort) {
return false;
}
if (sort >= ARRAY) {
... |
ea589ce7-a38c-4de4-b7b7-ec011185adc1 | 7 | @SuppressWarnings("unchecked")
public synchronized void init(Properties props)
throws BadRealmException, NoSuchRealmException {
super.init(props);
String jaasCtx = props.getProperty(IASRealm.JAAS_CONTEXT_PARAM);
String digestAlgorithm = props.getProperty(PARAM_DIGEST_ALGORITHM,
... |
55280630-44b8-4561-adda-0eb79f74ee76 | 0 | @Override
public void setCity(String city) {
super.setCity(city);
} |
442554b9-638b-4701-896d-741af5d02709 | 1 | final int getNextChar() {
int next = -1;
if (writeIndex != readIndex) {
next = charQueue[readIndex];
readIndex = readIndex + 1 & 0x7f;
}
return next;
} |
3b04c3ba-a5ae-4d99-8672-17218235c516 | 8 | public static Proposition findMatchingConceivedProposition(Proposition goal) {
{ Keyword testValue000 = goal.kind;
if ((testValue000 == Logic.KWD_PREDICATE) ||
((testValue000 == Logic.KWD_FUNCTION) ||
((testValue000 == Logic.KWD_ISA) ||
(testValue000 == Logic.KWD_EQUIVALENT))... |
7a4dc501-bde0-4a7d-b762-c95bec1a88f3 | 9 | public void addLine(double pXFrom, double pYFrom, double pXTo, double pYTo)
{
int lYFrom;
int lYTo;
// Do some rounding (but not in the way we expect it), limit values
if(pYFrom < pYTo)
{
// Round lYFrom (but .5 is handled oddly)
// 1.5001 - 2.5 -> 1.0001 - 2.0 -> 2
lYFrom = (in... |
6950eef0-5134-425d-a8ba-9a680ec9af31 | 8 | @EventHandler(priority = EventPriority.LOW)
public void onDiabloMonsterDamageEvent(final EntityDamageEvent event) {
if (event.getEntity() instanceof Monster) {
if (plugin.getSetAPI().wearingSet((LivingEntity) event.getEntity())) {
String sName = plugin.getSetAPI().getNameOfSet(
(LivingEntity) event.getE... |
6c037f17-66d7-41d0-b6d1-03e8440e8613 | 4 | public void wearAsBackpack(Backpack b)
{
//Take off previous backpack
if(getBackpack() != null) {getBackpack().setWearer(null);}
//If putting on backpack
if(b != null)
{
if(b.getWearer() != null) {b.getWearer().wearAsBackpack(null);}
b.moveToCont... |
4300547e-26fb-4b1a-a1b3-0565a4d5225c | 6 | @Override
public void execute(TransitionEvent event) throws Exception {
if(this.out == null) {
this.out = this.bean.getOut();
}
if(!this.rxModeAck) {
send(Statics.RX_HELI_ACK);
this.rxModeAck = true;
}
if(this.sender == null) {
initializeDataSender();
}
if(Statics.ACK.equals(event.getI... |
82c1c8ce-8ad5-4b23-a338-f4e762575352 | 8 | @Override
public Order getOrderByID(final Integer id) {
Connection conn = null;
PreparedStatement stmt=null;
Order order=null;
ResultSet rs = null;
try {
conn = dataSource.getConnection();
stmt = conn.prepareStatement("SELECT ORDER_ID, ORDER_DATE, U... |
02adc169-9a60-4487-91f4-bc69085d34e4 | 0 | public DocumentManager(int sizeOfDocSet) {
// call on the ancestors
super();
// set up the data arrays
docOpenStates = new boolean[sizeOfDocSet] ;
docPaths = new String[sizeOfDocSet] ;
docAlfaOrder = new int[sizeOfDocSet] ;
Outliner.documents.addDocumentRepositoryListener(this);
} |
6fe707dd-d2a2-4b6e-a983-d893ceee7a76 | 5 | public String toString() {
String out = "";
for (int i = (height - 1); i >= 0; i--) {
for (int z = 0; z < width; z++) {
if (z == (width - 1)) {
if (board[z][i] == ' ') {
out = out + "*" + System.getProperty("line.separator");
... |
0f3e4a04-00cc-4fef-94a7-5ba74dc6257a | 6 | public void run(){
try {
Socket socket = new Socket(ip, Integer.parseInt(port));
output = socket.getOutputStream();
output.flush();
ooutput = new ObjectOutputStream(socket.getOutputStream());
if(command != null){
FileInputStream finput = new FileInputStream(command);
... |
6573a8b0-f5d0-41d8-bca0-f2e03866b49e | 0 | public void go() throws NoSuchMethodException, InvocationTargetException, IllegalAccessException {
Being child = being.bear();
Supervisor.getSupervisor().registerBeing(child);
} |
ec6c5baf-3367-484c-9113-a82720f48ce9 | 6 | @Override
public Object receiveData(final Identifiable data) {
Object result = GenericResponses.ILLEGAL_DATA;
if (data instanceof JobTask) {
result = GenericResponses.ILLEGAL_HEADER;
final JobTask jt = (JobTask) data;
final UUID id = jt.getJobId();
fin... |
e36e9882-c354-4bee-9ead-f4e938570c04 | 9 | public void markSolidOccupant(int x, int y, int width, int height,
int orientation, boolean impenetrable) {
int occupied = 256;
if (impenetrable)
occupied += 0x20000;
x -= insetX;
y -= insetY;
if (orientation == 1 || orientation == 3) {
int temp = width;
width = height;
height = temp;
}
for... |
1ad15ab3-db63-4d25-ac4f-ef4beabc29f7 | 1 | public void addAccount(BankAccount account) throws IllegalArgumentException {
if (! canHaveAsAccount(account))
throw new IllegalArgumentException();
accounts.add(account);
} |
9eb1e3af-8c09-4a48-adb2-e23187bc6930 | 6 | private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
boolean verifie = true;
if(jTxtCreateNom.getText().equals("")){
jTxtCreateNom.setBackground(Color.gray);
verifie = false;
}
if(jTxtCreatePrenom.getText(... |
9e97b303-944e-4d2c-85dc-482278b15bf9 | 9 | public static void main(String[] args) {
@SuppressWarnings("resource")
Scanner scanner = new Scanner(System.in);
int startRange = 0;
int endRange = 0;
try {
startRange = scanner.nextInt();
endRange = scanner.nextInt();
} catch (NumberFormatException nfex) {
System.err.println("Invalid input " + ... |
9ac7ec73-bc46-42f7-801d-3309a3bb0b20 | 3 | public static String get(HttpServletRequest request, String name) {
Cookie[] cookies = request.getCookies();
if (cookies == null) {
return null;
}
for (int i = 0; i < cookies.length; i++) {
Cookie cookie = cookies[i];
String cookieName = GetterUtil.getString(cookie.getName());
if (cookieName.equ... |
b2c835c3-7ee3-47e0-b906-0321e4a49634 | 0 | public static byte[] decrypt(byte[] data, String publicKey,
String privateKey) throws Exception {
// 生成本地密钥
SecretKey secretKey = getSecretKey(publicKey, privateKey);
// 数据解密
Cipher cipher = Cipher.getInstance(secretKey.getAlgorithm());
cipher.init(Cipher.DECRYPT_MODE, secretKey);
return cipher.doFinal... |
27f35d49-a612-4a0d-954f-68f34b0e3aa8 | 4 | public Matrix times(Matrix B) {
Matrix A = this;
if (A.N != B.M) throw new RuntimeException("Illegal matrix dimensions.");
Matrix C = new Matrix(A.M, B.N);
for (int i = 0; i < C.M; i++)
for (int j = 0; j < C.N; j++)
for (int k = 0; k < A.N; k++)
... |
f00bf0e9-2e48-47a9-815d-68e1c757bc7d | 5 | static String findFile(File root, String name) {
// Cleans the results list at the beginning
List<File> results = new ArrayList<File>();
if (!root.isDirectory()) {
throw new IllegalArgumentException("File root is not a directory");
}
File[] files = root.listFiles();
for (int i = 0; i < files.length; i+... |
a3368023-d91e-4e69-9551-944d59586d20 | 5 | public EasySolve solve()
{
EasySolve ret = null;
List<Row> solverows = new ArrayList<Row>();
solverows.addAll(rows);
debugRows("Initial rows", solverows, modulus);
for (int workrowindex = 0, maxindex = solverows.size(); workrowindex < maxindex; workrowindex++)
{
... |
f9e9d8de-8585-42c1-a39c-afb3f892f320 | 4 | public boolean accept(File pathName) {
try {
String path = pathName.getCanonicalPath();
if (path.endsWith(".tmx") || path.endsWith(".tsx") ||
path.endsWith(".tmx.gz")) {
return true;
}
} catch (IOException e) {}
return f... |
b24e5e42-7961-410d-b5a1-ec8c4d9f2563 | 8 | @Override
public void insertUpdate(DocumentEvent ev) {
if (ev.getLength() != 1)
return;
int pos = ev.getOffset();
String content = null;
try {
content = textField.getText(0, pos + 1);
} catch (BadLocationException e) {
e.printStackTrace();
}
//Find where the word starts
int w;
for (w = pos... |
cd955659-650f-4067-80b4-83d16df0c7af | 0 | public Set<Integer> getVisited() {
return visited;
} |
2dceb995-4e81-4f27-8712-7a13d3e2e7f4 | 0 | public String getTableFiledName() {
return tableFiledName;
} |
4cd45ae3-82e6-4df0-b116-4f0b0d6712af | 8 | @Override
public Object getValueAt(final int rowIndex, int columnIndex) {
switch (columnIndex){
case 0: return sorok.get(rowIndex).tipus;
case 1: return sorok.get(rowIndex).sor;
case 2:
final JButton torlesGomb = new JButton(oszlopNevek[columnIndex]);
... |
70112eaf-52c1-4fbb-9880-d62017004fa6 | 6 | public static SceneNode trace(SpaceRegion region, Vec3 position,
Vec3 direction) {
SceneNode returned;
if ( region instanceof SpaceRegion && collidesWithRegion( region, position, direction ) ) {
if ( region instanceof GroupSector ) {
for ( SceneNode sn : ((GroupSector)region).getSons()) {
if ( s... |
d50385c4-2793-434b-8fa7-2490ec564966 | 5 | public void copyStateTo(RrdUpdater other) throws IOException, RrdException {
if(!(other instanceof Archive)) {
throw new RrdException(
"Cannot copy Archive object to " + other.getClass().getName());
}
Archive arc = (Archive) other;
if(!arc.consolFun.get().equals(consolFun.get())) {
throw new RrdExcept... |
5d585d90-2544-4e67-8986-abe95b9cd853 | 1 | public boolean getLinhaVenda(int id) throws ExceptionGerenteVendas {
if (atual.getLinhaVenda(id)) {
return true;
}
throw new ExceptionGerenteVendas("Nenhuma venda encontrada nesta data");
} |
1ce49e2f-d939-4c69-97fb-29d5f54ed69a | 9 | private void newMethod(GameBoardMark playerMark, int[] tempRowForChecks, int sign, int foo, int bar, int baz) {
for (int b1 = 0; b1 < 5; b1++) {
for (int b2 = 0; b2 < 5; b2++) {
int positionB = b1 * GameBoard.SQUARES_PER_SIDE + b2;
if (gameBoard.hasEmptyValueAt(GameBo... |
78ba66a3-46ed-4430-943a-ca9515343b08 | 8 | public static <T extends NucleotideFasta>NCBI_Q_TBLASTN newDefaultInstance(List<T> query,
List<String> query_IDs) {
return new NCBI_Q_TBLASTN<T>(query, query_IDs) {
/**
* Combines the formQuery() sendBLASTRequest() extractRID() and
... |
0a3ac1cc-48c4-48ea-9ee1-d0483a6c7696 | 7 | private boolean checkValidPosition(int positionX, int positionY) {
boolean ret;
boolean xOutOfBounds = positionX > getPlatformSizeX() || positionX < 0;
boolean yOutOfBounds = positionY > getPlatformSizeY() || positionY < 0;
boolean collision = false;
ArrayList<Rover> otherRove... |
2e0dfeb1-b897-4bb7-9fd2-9e9294ecaa32 | 3 | public static int binarySearch(int key, int[] list){//二分查找,返回key的索引。或者若无key,该key应该在位置(负数)
int low = 0;
int high = list.length - 1;
int middle = 0;
while(low <= high){
middle = low + (high - low)/2;
if(key < list[middle]) high = middle - 1;
else if(key > list[middle]) low = middle + 1;
else return mi... |
1de67e12-91a2-41ea-b415-9f7cb491e97b | 4 | @Override
public String getAsString(FacesContext facesContext, UIComponent component, Object object) {
if (object == null
|| (object instanceof String && ((String) object).length() == 0)) {
return null;
}
if (object instanceof Usuario) {
Usuario o = (U... |
cd68fc34-342e-4113-b954-2ce5a074ca27 | 3 | @Override
public void move(Excel start, Excel finish) {
for(Excel ex: coloredEx)
{
if (ex.getX() == start.getX() && ex.getY() == start.getY())
{
Dx += finish.getX() - start.getX();
Dy += finish.getY() - start.getY();
setColoredExes();
return;
}
}
} |
3bd97cf7-d655-41d7-b07f-8a13ad430f8d | 1 | public void visitInstanceOfExpr(final InstanceOfExpr expr) {
if (previous == expr.expr()) {
previous = expr;
expr.parent.visit(this);
}
} |
6db63a09-b437-4a9e-a28f-7fd8d60d7482 | 5 | @Override
public boolean onCommand(CommandSender sender, Command cmd,
String commandLabel, String[] args){
if(commandLabel.compareToIgnoreCase("gelplacement") == 0){
if(sender.hasPermission("portalgel.gelplacement")){
if(args.length == 1){
if(args[0].compareToIgnore... |
022325c8-e641-4872-bab0-504c43611c55 | 8 | protected boolean disconnectInput(NeuralConnection i, int n) {
int loc = -1;
boolean removed = false;
do {
loc = -1;
for (int noa = 0; noa < m_numInputs; noa++) {
if (i == m_inputList[noa] && (n == -1 || n == m_inputNums[noa])) {
loc = noa;
break;
}
}
if (loc >= 0... |
78f1e0a2-5821-45e0-adb6-1931a7d2a576 | 2 | protected void logRequest( Class<? extends HttpRequestBase> reqType, Request request) {
if (debugRequests) System.err.println(reqType.getSimpleName()+" "+request);
} |
e3d99559-2c25-4b11-933b-b2e87204a6f5 | 7 | public boolean checkAccusation(Card person, Card room, Card weapon){
ArrayList<Card> accusation = new ArrayList<Card>();
boolean personMatch = false, roomMatch = false, weaponMatch = false;
accusation.add(person);
accusation.add(room);
accusation.add(weapon);
for(Card temp : solution){
if(person.name... |
be9c2d3a-3a9a-4cb3-af4e-c64178170ec4 | 4 | public <T extends ElementType<E>> boolean positiveLookaheadBefore(ElementType<E> before,
T... expected) {
E lookahead;
for (int i = 1; i <= elements.length; i++) {
lookahead = lookahead(i);
if (before.isMatchedBy(lookahead)) {
break;
}
for (ElementType<E> type : expected) {... |
15d100f6-a2c0-4f82-9a67-efa6b7fecef5 | 3 | protected void processKeyEvent(KeyEvent e) {
if (e.getID() == e.KEY_PRESSED) {
// if backspace is pressed, clear the map
if (e.getKeyCode() == KeyEvent.VK_BACK_SPACE &&
inputManager.getMaps(action).size() > 0)
{
inputManager.clearMap(acti... |
9db752d7-e567-4b42-a5c1-fbbfd3ab40df | 7 | public Atividade SelectATividadePorNome(String NomeAtividade) throws SQLException {
Connection conexao = null;
PreparedStatement comando = null;
ResultSet resultado = null;
Atividade atividade = null;
try {
conexao = BancoDadosUtil.getConnection();
com... |
21ae10bb-3e41-4366-bc35-dd5fca2cdd72 | 3 | @Override
public void run() {
while(true){
// isIdle = false;
if (serverHandler!=null) {
serverHandler.run(); //core service
}
// isIdle = true;
thrdPlInst.returnThread(this);
synchronized(this) {
try {
this.wait();
} catch (InterruptedException e) {
// TODO A... |
f25dae75-f8b9-460b-a7d7-197937d613c8 | 8 | public void rekenAf(Persoon pers){
hoeveelheidPersonen += 1;
double totaalPrijs=0.00;
boolean kkh=false; //kkh=kortingskaarthouder
double kortingspercentage=0.00;
boolean kortingMax=false;
double maxKorting=0.00;
double korting=0.00;
//als de persoon een k... |
923838ee-7a75-4b5e-b155-eb9eec1fd285 | 5 | public void move() {
if (!inPlay)
return;
pos.x += dx;
pos.y += dy;
if (pos.x < xrangemin) {
pos.x = xrangemin;
dx = -dx;
}
if (pos.x > xrangemax) {
pos.x = xrangemax;
dx = -dx;
}
if (pos.y < yrangemin) {
inPlay = false;
game.updateScore(0);
}
if (pos.y > yrangemax) {
i... |
462895e7-eb8d-42fb-88cb-5ca90f8bc063 | 8 | */
private void positionMap(Tile pos) {
Game gameData = freeColClient.getGame();
int x = pos.getX(),
y = pos.getY();
int leftColumns = getLeftColumns(),
rightColumns = getRightColumns();
/*
PART 1
======
Calculate: bottomRow, topRow, ... |
c285cdf7-b54b-41ab-9dd2-8bf07934793b | 4 | public static boolean listaHasonlo( LinkedList<Integer[]> lista, Integer[] parok )
{
for( Integer[] i : lista )
{
int j=0;
for( j=0; j<6; j++ )
{
if( i[j] != parok[j] )
break;
}
if(j == 6)
return true;
}
return false;
} |
dcf4fc16-4be8-47aa-9b6e-c98f0282f5d9 | 2 | static Map<String, Integer> getMethods(final String program) {
char[] chars = program.toCharArray();
Map<String, Integer> methodMap = new HashMap<String, Integer>();
int methodCount = 0;
for (int p = 0; p < chars.length; p++) {
char c = chars[p];
if (c == '[') {
... |
b3482d5d-1361-4a52-8e6e-65a0eec2c81d | 0 | @Test
public void verifyMethodAnnotationsFound()
{
assert this.foundMethodAnnotation;
} |
37192071-accd-481b-aeb7-b6592d7535bf | 0 | public AbstractPlay get(int number) {
return everyPlay.get(number);
} |
389d6099-8de7-4283-b788-26d4feabc69b | 4 | public LinkedList<Node> allNeighbours(int x, int y) {
LinkedList<Node> neighbours = new LinkedList<Node>();
int thisX = x - 1;
int thisY = y - 1;
// Prevent Nodes on the edge of the map from being added as neighbours.
for (int i = 0; i < 3; i++) {
for (int j = 0; j < 3; j++) {
if (i == 1 && j == 1) {
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.