method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
9b402253-8171-4018-8c81-aa4958aa9074 | 4 | @Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
Video other = (Video) obj;
if (id != other.id)
return false;
return true;
} |
9a7bd6cb-a689-4a92-bcd1-075331740c0a | 9 | public void insertString(int offset,
String str,
AttributeSet a)
throws BadLocationException{
if(str.length() == 1 && str.charAt(0) == '\n' && offset>0){//New line
String s=getText();
//Locating previous line
int lineStart=offset-1;
for(; lineStart>=0; lineStart--)
... |
ad984ff3-d2af-4552-aa4f-b6d788db1208 | 8 | public static void main(String[] args) throws Exception {
String baseFilename = args[0];
int numShards = Integer.parseInt(args[1]);
FriendsOfFriends fof = new FriendsOfFriends(baseFilename, numShards, false);
BufferedReader cmdIn = new BufferedReader(new InputStreamReader(System.in));
... |
72dfbd8c-ff47-4bef-b78b-e572d5109dad | 9 | public void render(float x, float y, boolean flipped, boolean loop)
{
glEnable (GL_BLEND);
glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
long passedTime;
width=x+size;
height=y+size;
passedTime = System.nanoTime() - startTime;
if(passedTime/1000000 >= delay)
{
if(current==waitFrame){wait=... |
630cc835-16d7-422e-bd02-146b96bbe0c8 | 9 | public ListNode sortList1(ListNode head) {
if (head == null || head.next == null) {
return head;
}
ListNode l = null, lc = null, r = null, rc = null, m = head;
head = head.next;
while (head != null) {
if (head.val < m.val) {
if (lc == null)... |
82d27979-afd9-4f35-b254-27700c9ad8eb | 1 | private int getColumns(String tabla) {
int columns = -1;
String query = "SELECT Count(*) as total FROM INFORMATION_SCHEMA.Columns where TABLE_NAME='" + tabla + "' AND table_schema='" + vg.baseDeDatos + "' GROUP BY column_default";
try {
PreparedStatement pstm = (PreparedStatement) c... |
ba5111c9-23a2-4ae1-a431-4a62f023e747 | 3 | public Matrix subtractRowMeans(){
Matrix mat = new Matrix(this.numberOfRows, this.numberOfColumns);
for(int i=0; i<this.numberOfRows; i++){
double mean = 0.0;
for(int j=0; j<this.numberOfColumns; j++){
mean += this.matrix[i][j];
... |
fa1ddfef-e9d7-43f6-8cd2-f515a9ea8481 | 4 | public int divide(int a, int b) {
int sign = 1; // Sign is positive by default
int result = 0;
if (b == 0)
throw new IllegalArgumentException("The divisor can't be 0!");
// Handle sign if a is negative
if (a < 0) {
a = -a;
sign = -sign;
... |
b7b1fdfc-0df6-433f-ba58-9f07bdf1d3bf | 1 | public void listarAtividadesAtrasadas() {
AtividadeBO atividade = new AtividadeBO();
try {
tbAtividadesAtrasadas.setModel(DbUtils.resultSetToTableModel(atividade.preencherTabelaAtividadeAtrasadas(usuarioLogado.getDepartamento().getCodigo())));
} catch (SQLException ex) {
}
... |
e517a46a-abb8-40f7-a2a5-f04021067147 | 2 | public static void tagMp3(final String originalFilename, final String endFilename, final Mp3Metadata metadata) {
// All tagging was found on the GitHub README - https://github.com/mpatric/mp3agic
try {
final Mp3File mp3File = new Mp3File(originalFilename);
final ID3v1 tag;
if (mp3File.hasId3v1Tag()) {
... |
585f8154-e1f8-4a05-9b24-25bea2ff3fa1 | 9 | public Ranker create(RankerType ranker) {
switch (ranker) {
case CONJUNCTIVE:
return new RankerConjunctive(indexer);
case FAVORITE:
case COSINE:
return new CosineRanker(indexer);
case QL:
return new QLRanker(indexer);
case PHRASE:
return new PhraseRanker(indexer);
case LINEAR:
r... |
ca9a9e92-e56d-418a-b0de-fca7abbb526f | 0 | private void writebuttonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_writebuttonActionPerformed
// TODO add your handling code here:
}//GEN-LAST:event_writebuttonActionPerformed |
c4bd5004-ac59-4df9-b8c5-4bd2e49c037b | 1 | private ArrayList<Tilausrivi> luoTilausrivi(HttpServletRequest request) {
// Onko ostoskoriin jo lisätty tuotteita?
// Tarkistetaan sessiomuuttujasta.
@SuppressWarnings("unchecked")
ArrayList<Tilausrivi> tilausrivit = (ArrayList<Tilausrivi>) request
.getSession().getAttribute("tilausrivit");
// Jos ses... |
54cd818f-cfbc-44d3-b545-9f9b1e18676d | 3 | public int minLookback( int optInTimePeriod )
{
if( (int)optInTimePeriod == ( Integer.MIN_VALUE ) )
optInTimePeriod = 30;
else if( ((int)optInTimePeriod < 2) || ((int)optInTimePeriod > 100000) )
return -1;
return (optInTimePeriod-1);
} |
11d15193-4b75-4f2d-9cb0-9bd8673b6227 | 0 | public void SetNumebrOfPackets(int packets)
{
NumberOfPackets = packets;
} |
5fdfb2cc-2807-4431-8696-0a2c7d110a2e | 3 | public void play() {
if (!loading()) {
// Make sure there is a sequencer:
if (sequencer == null)
return;
try {
// start playing:
sequencer.start();
// event will be sent when end of track is reached:
sequencer.addMetaEventListener(this);
} catch (Exception e) {
errorMessage("Excep... |
541fdf69-ac55-4fd2-815d-8b040146ac42 | 5 | private void QUANT() {
position = 0;
double arrayPix[][] = new double[SIZE][SIZE];
arrayForZigZag = new int[3 * HEIGHT * WIDTH];
int quant[][];
int row;
int col;
int x = 0;
int y = 0;
final int COUNT_LAYER = 3;
for (int element = 0; elemen... |
96e823e5-6bf0-4700-91a9-a32ac465077f | 1 | public DBRepositoryUtils(){
try {
Class.forName("org.sqlite.JDBC");
} catch (ClassNotFoundException e) {
e.printStackTrace();
System.exit(-1);
}
connectionString = System.getProperty("omnom.db.connectionString");
} |
f28d3160-363a-406b-a942-a5122c5f4b04 | 0 | public List findByTitle(Object title) {
return findByProperty(TITLE, title);
} |
b82d3af7-63c9-4b91-b023-43c37c697f49 | 7 | @Override
public void run() {
BufferedReader stdIn = new BufferedReader(new InputStreamReader(System.in));
String userInput;
try {
while (((userInput = stdIn.readLine()) != null) && exit == false) {
// shut dwon if input equals "!exit".
if (userInput.equals("!exit")) {
exit = true;
... |
a0165f23-b163-497c-a3d4-cfdbc3502cba | 0 | @Override
public Object getValue() {
return nativeValue;
} |
95ca40ee-7cc3-476d-a139-1f3b916d935c | 7 | private void setAudioDefault(Attributes attrs) {
// find the value to be set, then set it
if (attrs.getValue(0).equals("starttime"))
audioDef.setStartTime(Integer.valueOf(attrs.getValue(1)));
else if (attrs.getValue(0).equals("endtime"))
audioDef.setEndTime(Integer.valueOf(attrs.getValue(1)));
else if (at... |
d57bd6a7-a903-4341-9cdf-136b55f6ae21 | 4 | private void programmerLoadButton(java.awt.event.ActionEvent evt)
{
programmerThread.stop();
JFileChooser fileChooser = new JFileChooser();
fileChooser.setDialogTitle("Please Specify the File To Open");
File fileToOpen;
BufferedReader readIn;
String newCode = new Stri... |
e44ccfd2-5b8e-4d58-87c3-f5078a8f22ad | 0 | @Override
public String getDesc() {
return "Default";
} |
eabc3f73-fe97-43ed-9e5e-7eb27e9fa41e | 4 | @Override
public boolean equals(Object obj) {
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
final Sysvar other = (Sysvar) obj;
if ((this.idSysvar == null) ? (other.idSysvar != null) : !this.idSysvar.equa... |
869df8fc-1fdc-4c93-828e-ed22b352bb9b | 6 | public void bind(SocketAddress address, IoHandler handler,
IoServiceConfig config) throws IOException {
if (handler == null) {
throw new NullPointerException("handler");
}
if (address != null && !(address instanceof InetSocketAddress)) {
throw new IllegalArgu... |
1d1b632b-558f-4106-8c10-715725b2a436 | 0 | public Menu() {
initComponents();
} |
557ccd84-1d7d-4bf5-a039-d5e5c8e810ae | 8 | public Player[] getPlayersList(String playersListFile){
/*
* Считается, что файл со списком игроков выглядит так
* Mike:plays=15:rating=5&John:rating=1:plays=1&Emma:rating=7:plays=22&Kate:plays=20:rating=4
*/
File file = new File(playersListFile);
/* если файла нет, то считывать информацию неоткуда, верн... |
b4852ff3-2d88-4663-9842-8fbd58c36563 | 5 | public void setStatement(Integer i, PreparedStatement stmt, Object stuff) throws SQLException {
switch (this.s_to_int(this.campos[i][1])) {
case 0:
stmt.setInt(i, (Integer) stuff);
break;
case 1:
stmt.setString(i, (S... |
5855d9bb-9db4-4d31-9750-2e1c56984e74 | 5 | public TerminalSize getPreferredSize() {
int widthOverride = 0;
int heightOverride = 0;
if(preferredSizeOverride != null) {
widthOverride = preferredSizeOverride.getColumns();
heightOverride = preferredSizeOverride.getRows();
}
if(widthOv... |
0a290c66-7ffe-46b2-98a1-701b88702205 | 4 | public int eliminarCliente(String DNI){
ArrayList<Cliente>dbTemp=new ArrayList<>();
int condicion = 0;
dbTemp=tablaDeClientes();
for(int i = 0; i < dbTemp.size();i++){
String valorEliminar = dbTemp.get(i).getDNI();
String valorTransaccion = d... |
72dbeaab-3a55-4d41-9820-0ed40277a6b6 | 9 | private void readRotLibrary(String rotFilename) throws Exception {
rotFile = rotFilename;
volFilename = rotFile + ".vol";
// HANDLE THE NORMAL AAs
FileInputStream is = new FileInputStream( rotFilename );
BufferedReader bufread = new BufferedReader(new InputStreamReader(is));
String curLine = null;
... |
c74dba0b-709b-4132-bc07-bf8ddf0157a3 | 1 | public void visit_lmul(final Instruction inst) {
stackHeight -= 4;
if (stackHeight < minStackHeight) {
minStackHeight = stackHeight;
}
stackHeight += 2;
} |
22a6de34-fd1f-4a1a-aa22-baa4e44096dc | 7 | public Item findCorpseRoom(List<Item> candidates)
{
for(int m=0;m<candidates.size();m++)
{
final Item item = candidates.get(m);
if((item instanceof DeadBody)&&(((DeadBody)item).isPlayerCorpse()))
{
Room newRoom=CMLib.map().roomLocation(item);
if(newRoom != null)
return item;
}
}
for(in... |
d08b6dbd-6cca-4fea-9537-9f7d1f25422b | 2 | @Test
public void resolve() {
int sum = 0;
BigDecimal fac = new BigDecimal(1);
for (int i = 1; i <= 100; i++) {
fac = fac.multiply(new BigDecimal(i));
}
while (fac.doubleValue() >= 1) {
sum += fac.remainder(new BigDecimal(10)).intValue();
fac = fac.divide(new BigDecimal(10));
}
print(sum);
} |
6cfaaeb6-c53f-415c-8d7b-a0eee7f95247 | 4 | public Color getColor(int row, int col) {
if (row >=0 && row < rows && col >= 0 && col < columns)
return grid[row][col];
else
return null;
} |
05590fb8-45cf-43b7-b2a1-f8f081805107 | 7 | static String canonicalize(String code, boolean caseSensitive)
{
if (code == null || code.length() == 0)
{
return null;
}
// Support legacy language codes. Map three obsolete language codes
// { "iw", "ji", "in" } to new official ones { "he", "yi", "id" }.
... |
fe3c38ed-16b8-43e1-8a3a-d596079c21cb | 0 | public void mouseClicked(MouseEvent e) {
dismissBox();
} |
4d2d18a7-7ca9-43a9-938d-1139b923e01a | 2 | public static void main(String[] args) {
int x = 1;
if (x == 1) {
; // empty statement
} else {
while (true) {
;//empty statement
}
}
} |
aebe41e1-1758-48ab-bc9e-206e8d80266d | 1 | public JSONObject optJSONObject(String key) {
Object object = this.opt(key);
return object instanceof JSONObject ? (JSONObject) object : null;
} |
ba6634f6-17b4-4c5c-891c-eb7ac4aab633 | 5 | public void add(int index, E element) throws IndexOutOfBoundsException
{
if(index > size || index < 0)
throw new IndexOutOfBoundsException();
int count;
Node temp;
if(index > size/2){
count = size;
temp = tail;
while(--count >= index)
temp = temp.prev;
}
else{
count = -1;
temp = head;... |
405e102e-f8be-42ae-814d-7a8175f3a446 | 9 | protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException
{
MessageManager mm = new MessageManager(ds);
ArrayList<MessageDetails> messages;
String path = req.getRequestURI();
String[] pathComponents = path.split("/");
StringBuffer jsonBuffer = new StringB... |
bc57d1b7-dcfd-48e0-86df-3708c91c3dab | 4 | @Override
public void run() {
while (Running) {
for (int i = 0; i < ticks.size(); i++) {
Tick t = ticks.get(i);
try {
t.tick();
} catch (Exception e) {
Log("ERROR TICKING!");
e.printStackTrace();
}
}
try {
Thread.sleep(10);
} catch (InterruptedException e)... |
cc8e6694-53f0-4226-a18d-6d0229446c21 | 9 | private void custom_algorithm(Object obj)
{
if (alternate==false)
{
if(((Elevator)obj).Get_direction() == true)
{
if(((Elevator)obj).Half_Increment() == false)
{
((Elevator)obj).Decrem... |
1c343127-602a-4b4b-ac5b-0113f8fa016b | 0 | public WatchKey getWatchKey() {
return watchKey;
} |
d87b59fd-9a19-4fe9-bf7c-a0a7839ee564 | 2 | private void resize(int capacity)
{
LinearProbingHashST<Key, Value> t = new LinearProbingHashST<Key, Value>(
capacity);
for (int i = 0; i < M; i++)
if (keys[i] != null)
t.put(keys[i], vals[i]);
M = t.M;
N = t.N;
keys = t.keys;
vals = t.vals;
} |
3e18a481-06fb-4267-9135-e67922aa3ec2 | 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... |
dee9277c-6e31-4c32-b6ab-e68f6fce7d28 | 4 | @Test
public void WhenLoadingFromExistingFile_ExpectResultedRoutingTable() {
RoutingTable routingTable = new RoutingTable();
try {
persistenceDelegate_.load(VALID_FILE, routingTable);
} catch (FileNotFoundException e) {
} catch (PersistencyException e) {
}
... |
d7924289-13de-44a3-b033-01ebee57f38e | 8 | public void run() {
byte[] command = new byte[4];
ok = 0;
while (ok != -1) {
try {
ok = is.read(command);
int com = Conversions.ByteArrayToInt(command);
switch (com) {
case Constants.ADDGAME:
addCommand(connection, is);
break;
case Constants.GAMELISTING:
sendGames(os);
b... |
3baa233d-2c9e-465a-b492-321321a5b047 | 3 | @Override
public ChatRoomSession login(String username, String password)
throws ChatRoomLoginException, RemoteException {
if(users.containsKey(username)) {
if(!users.get(username).equals(password)) {
throw new ChatRoomLoginException();
}
}... |
f2e6446c-1b09-4e93-9887-12c2dcbe792b | 5 | static void detectB1(G4State s) {
if (s.curIndex != 0) {
while (s.b1 <= s.a0 && s.b1 < s.width) {
int r = s.ref[s.refIndex] + s.ref[s.refIndex + 1];
if (r == 0)
s.b1 = s.width;
s.b1 += r;
if (s.refIndex + 2 < s.ref.l... |
aa73f6a3-7646-45b5-a865-a8731704ac4a | 5 | public void setWireRadius(double radius){
if(radius<=0.0D)throw new IllegalArgumentException("The wire radius, " + radius + ", must be greater than zero");
if(this.wireSeparation!=-1.0D && this.wireSeparation<=2.0D*radius)throw new IllegalArgumentException("The wire separation distance, " + this.wireSep... |
f58e1651-c3fa-41a1-a25d-f52fda1cd71c | 1 | private RegistrantList genRegData(int aiNumOfRecs)
{
RegistrantList laRegList = new RegistrantList();
// Only send this if you want to print the badge
// laRegList.setRfidPrinter("TestPrinter");
// Put all the attribute that you want control over. This is so
// we can handle removal of attributes when a regi... |
eecb3020-3df3-44d1-8adf-c37a7e9668ab | 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... |
87c224ae-75a7-4d13-ae98-9795b2f85a10 | 7 | public static void adjustY() {
Pose myPose = Robot.getInstance().getOdometryPoseProvider().getPose();
float offset = (float) (8.5*Math.sin(myPose.getHeading()*Math.PI/180));
float[] distances = new float[5];
distances[0] = Math.abs(myPose.getY() + offset + 120);
distances[1] = Math.abs(myPose.getY() + offset ... |
7d8463c1-214b-4bcd-bbee-2018b97a3dfa | 8 | @Override
public void update() {
// TODO Auto-generated method stub
Event ev;
while(eventExist())
{
ev = popEvent();
if(ev.getName().equals("destroy"))
{
if(alive())
{
popBonus=(int) (Math.random()*100);
if(popBonus < 50)
listElements.addElement(new Bonus(x,y));
else if... |
6d456bda-f56c-495b-bc9c-bb8524e1252e | 2 | @Override
public void characters(char[] ch, int start, int length) throws SAXException {
if (tag == null || Tags.USER == tag) {
return;
}
valueTag = new String(ch, start, length).trim();
} |
ff82660f-3d9d-4e96-a967-21152ab58bf4 | 0 | public long getCreationTime() {
return creationTime;
} |
aca2a5bb-6e3f-4ecb-a0f7-90957d6f8526 | 1 | public Weapon getWeaponFromList(WeaponList List) {
if (List == NONE) {
return null;
}
return null;
} |
1b67ef7f-8ef5-48ff-a52b-87660f1f3e17 | 6 | public void loadFromFile(String filePath) throws Exception {
if (filePath == null || filePath.equals("")) {
throw new NullPointerException("File path is null.");
}
DocumentBuilderFactory docFactory = DocumentBuilderFactory
.newInstance();
DocumentBuilder dBuilder = docFactory.newDocumentBuilder();
... |
36d9f24a-a32b-4eb4-814a-16cbfe5cf757 | 4 | private void setSysTray()
{
if (SystemTray.isSupported())
{
popupMenu = new PopupMenu();
itemExit = new MenuItem("Exit");
itemExit.addActionListener(new ActionListener()
{
@Override
public void actionPerformed(ActionEve... |
44561abe-466a-4654-adb9-65c7a162332f | 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... |
bfbe7ffd-bd4f-4d83-bf98-cc35a6620ae8 | 5 | public static TreeMap<Integer,Integer> pitchRangeTrunkate(TreeMap<Integer,Integer> pitchTreeIn, char switcher){
TreeMap<Integer,Integer> pitchTreeOut = new TreeMap<Integer,Integer>();
Iterator<Integer> pitchIterator = pitchTreeIn.keySet().iterator();
while(pitchIterator.hasNext()){
int key = pitchI... |
7e857784-5e0b-4de1-8cca-e1de578a35a0 | 6 | private static boolean equalsTypeArray(Class<?>[] a, Class<?>[] o) {
if (a.length != o.length) {
return false;
}
for (int i = 0; i < a.length; i++) {
if (!a[i].equals(o[i]) && !a[i].equals(o[i].getSuperclass())) {
return false;
}
}
... |
5221a3be-bae9-44dc-af96-9c299cc3e2d6 | 2 | public void writeData(final DataOutputStream out) throws IOException {
out.writeShort(maxStack);
out.writeShort(maxLocals);
out.writeInt(code.length);
out.write(code, 0, code.length);
out.writeShort(handlers.length);
for (int i = 0; i < handlers.length; i++) {
writeCatch(out, handlers[i]);
}
out.... |
4220a5d7-9dc7-4360-8d86-b720c180f249 | 2 | @Override
public Component getListCellRendererComponent(
JList list,
Object value,
int index,
boolean selected,
boolean expanded) {
String text=value.toString();
label.setText(text.substring(1));
... |
42d75251-8109-401a-8817-bdab1023b20c | 8 | public static boolean isValidTetriminoMatrix(int[][] matrix) {
int rows = matrix.length, cols = matrix[0].length;
matrix = Matrices.padMatrix(matrix);
int count = 0;
for (int i = 1; i < rows + 1; i++) { //ranges adjust for padding
for (int j = 1; j < cols + 1; j++) {... |
0f634dab-b789-4dc2-b286-f603d23956d5 | 2 | public static void checkPlayersBan( String sender, String player ) throws SQLException {
BSPlayer p = PlayerManager.getPlayer( sender );
Ban b = getBanInfo( player );
if ( b == null ) {
p.sendMessage( Messages.PLAYER_NOT_BANNED );
return;
} else {
Simp... |
e03b48aa-c960-48a9-8f64-3dc6a86d45e2 | 5 | @EventHandler(priority = EventPriority.HIGHEST)
public void onBlockBreakEvent(BlockBreakEvent e){
for(MClan m : instance.clans){
for(MChunk c : m.getChunks()){
if(e.getBlock().getChunk().getX() == c.getX() && e.getBlock().getChunk().getZ() == c.getZ()){
if(!c.getClan().canBreakBlock(e.getPlayer().getName... |
3fa6e303-811a-406e-95db-80109c5ed35b | 5 | public int reveal(){
if(flag){
opened = false;
return -1;
}
if(bomb){
opened = true;
return 9;
}
opened = true;
if (getBombCount() == 0){
ArrayList<Spot> n = grid.getNeighbors(loc);
for(Spot s : n){
if(!s.opened)
s.open();
}
}
return getBombCount();
} |
7b6a30e9-5892-4b85-9645-6393dfdc7d3d | 2 | @Override
public int hashCode()
{
final int prime = 31;
int result = 1;
result = prime * result + ( ( this.annotatedElementType == null ) ? 0 : this.annotatedElementType.hashCode() );
result = prime * result + ( ( this.annotationType == null ) ? 0 : this.annotationType.hashCode()... |
0f367565-db7d-4346-a0dc-ea2578586a09 | 0 | public String getCityName() {
return cityName.get();
} |
89c65f3c-a30f-41fc-b3a8-c6e3ab90de12 | 3 | public void run(myLinkedList list) {
Node head = list.getfirst();
Node first = head;
while (first != null) {
Node second = first.next;
while (second != null) {
if (second.getValue() == first.getValue()) {
first.next = second.next;
}
second = second.next;
}
first = first.next;
}
} |
30947e0a-afbd-4dd8-9023-d1d96fa0d714 | 2 | public void setDAO(String daoLine) {
if (daoLine.equals("Mock")) {
dao = new MockDAO();
}
else if (daoLine.equals("MySQL")) {
dao = new MySQLDAO();
}
} |
5ff4c19b-f26f-40a3-9922-2e8661ecd8d6 | 8 | public int find_split(Context cx, Scriptable scope, String target,
String separator, Scriptable reObj,
int[] ip, int[] matchlen,
boolean[] matched, String[][] parensp)
{
int i = ip[0];
int length = target.length();
... |
01b1153b-2cac-44b1-9820-779ec464e3ec | 7 | public static double sinh(double x) {
boolean negate = false;
if (x != x) {
return x;
}
// sinh[z] = (exp(z) - exp(-z) / 2
// for values of z larger than about 20,
// exp(-z) can be ignored in comparison with exp(z)
if (x > 20.0) {
return exp(x) / 2.0;
}
if (x < -20) {
return -exp(-x) / 2... |
c96ef26b-38ff-4d7a-aa87-bb5c7e00709d | 7 | private void doCompare(List<Homonym> homonymList1, List<Homonym> homonymList2) {
for (Homonym w1: homonymList1) {
Homonym w2 = getWord(homonymList2, w1.getOrig());
if (w2 == null) {
print(Level.WORD, w1, w2, "Homonym not found!");
continue;
}
... |
fa17823d-5077-4879-a24c-3bbc666c9543 | 4 | public static long getPawnZobristKey(Board board) {
long zobristKey = 0L;
for (int index = 0; index < 120; index++) {
if ((index & 0x88) == 0) {
int piece = board.boardArray[index];
if (piece == W_PAWN) // White piece
{
zobristKey ^= PIECES[Math.abs(piece) - 1][0][index];
} else if (piece ... |
1850cbee-6ba1-4520-8d08-bf03ea562919 | 8 | private boolean runInputCheck(String s)
{
if (!baseMode) {
s = s.toUpperCase();
if (s.length() > 4) {
return false;
} else {
for (int i = 0; i < s.length(); i++) {
if (!correctChar(s.charAt(i))) {
... |
46d7aca9-19c6-4012-b673-33b4f14bf11f | 3 | private void clearReleasedPowerups()
{
int index = 0;
boolean releasedPowerupsCleared = false;
while(!releasedPowerupsCleared)
{
releasedPowerupsCleared = true;
for(int i = index; i < powerups.size(); i++)
{
if(powerups.get(i).isReleased())
{
powerups.remove(i);
index = i;
... |
c58346d5-1896-43f8-81dc-18b9c712d609 | 2 | public Type superclass(final Type type) {
final TypeNode node = getExtendsNode(type);
if (node != null) {
final Collection succs = extendsGraph.succs(node);
final Iterator iter = succs.iterator();
if (iter.hasNext()) {
final TypeNode v = (TypeNode) iter.next();
return v.type;
}
}
return ... |
e9579d09-4a48-482e-8fc4-020e30aaf077 | 2 | private int check_number_1(int n) {
int answer = check_number_2(sqrt_max_ * n);
if (answer != -1) {
return answer;
}
if (n + 1 > sqrt_max_) {
return -1;
}
return check_number_1(n + 1);
} |
3b447fa9-7cea-4033-9075-cdb305b444e2 | 1 | @Override
public void onSpawnTick(SinglePlayerGame game) {
if (game.getTick() % 50 == 0) {
game.spawnEntity(player.getPos() + 25, 25, spawn());
}
} |
1a1e160b-db17-438a-80f4-f9172d3b7fb2 | 7 | public List<IllegalCombo> getViolatedCombos(Generation gen) {
List<IllegalCombo> allCombos = getViolatedMovesets(gen);
ArrayList<IllegalCombo> illegal = new ArrayList<IllegalCombo>();
for (IllegalCombo combo : allCombos) {
// Check the nature/ability
if ((combo.g... |
83583170-c70b-49dd-b20e-f38e23ddf4b5 | 3 | @Override
public void startJoinGame(GameDescription game) {
//presenter.setSystemState(SystemState.JOINING);
currentGame = game;
getSelectColorView().resetEnabled();
for (PlayerDescription p : game.getPlayerDescriptions()) {
if (p.getColor() != null && !p.getName().equals(presenter.getPlayerInfo().getName()... |
9aad34a9-868e-43c8-81ed-c96fd317d015 | 5 | public Long getLongValue( String key ) {
if( key == null )
return null;
HTTPHeaderLine hl = this.get( key );
if( hl == null )
return null;
if( hl.getValue() == null || hl.getValue().length() == 0 )
return null;
try {
return new Long( hl.getValue() );
} catch( NumberFormatException e ) {
... |
f5d3442b-4aff-49b8-9861-f7e6ccbc2da1 | 5 | @Override
public CompositeContext createContext(ColorModel srcColorModel, ColorModel dstColorModel, RenderingHints hints)
{
return new CompositeContext()
{
@Override
public void compose(Raster src, Raster dstIn, WritableRaster dstOut)
{
if (src.getSampleModel().getDataType() != DataBuffer.TYPE_INT
... |
9c8dc058-9c20-4ae9-a43e-76e79291bea8 | 5 | @Override
public boolean bookingExists(long booking_id) throws ConnectException {
if (this.dbConnection == null) {
connectToDB(this.dbFileName);
}
String sql = "SELECT COUNT(ID) FROM bookings WHERE booking_id = " + booking_id;
ResultSet result = executeQuery(sql);
try {
if (result != null) {
return... |
01723d7e-a54a-4e3a-9416-8bb3eca8e1c0 | 1 | @Override
public Response serve(IHTTPSession request) {
String uri = request.getUri();
// handle favicon.ico
if(uri.equals("/favicon.ico")) {
return CommonResponses.showFavicon();
}
Session session = Session.fromNanoCookie(request.getCookies());
String responseString = this.serveAsJson(request, session... |
a597b212-af96-4017-b439-06997ec376bc | 1 | public void changeTurn(){
if(this.getTurn() == 1){
this.turn = 2;
} else {this.turn = 1;}
} |
6f52648e-a9e0-4db0-9cdf-3843df03a12c | 4 | protected boolean isInPopup(Component src) {
for (Component c = src; c != null; c = c.getParent()) {
if (c == contents) {
return true;
} else if (c instanceof java.applet.Applet || c instanceof Window) {
return false;
}
}
return false;
} |
e1c206fb-4c61-4bb7-8bcd-0435c2c1028d | 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... |
5d58846d-81ef-45ee-b95b-bc78d0db1f91 | 3 | public void tick(){
if (System.currentTimeMillis() >= targetTime && animate) {
index++;
now = System.currentTimeMillis();
targetTime = now + miliSeconds;
if(index>animImages.length-1){
index = 0;
}
}
} |
fe7d67ac-08b8-4e76-bc3d-d077678e21eb | 5 | @Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
Ticket ticket = (Ticket) o;
if (id != ticket.id) return false;
if (Double.compare(ticket.price, price) != 0) return false;
return true... |
442b0ea0-c8b3-40f2-92ac-21d31203ee21 | 7 | public Statistics(boolean[][] world)
{
W = world[0].length;
H = world.length;
worlds.add(world);
maximumGrowthRate = 0.0;
maximumDeathRate = 0.0;
loopStart = 0;
loopEnd = 0;
int previousPopulation = countPopulation(world);
int currentPopulation;
maximumPopulation = previousPopu... |
515709a0-3cd0-49cf-a960-12991061fca5 | 8 | @Override
public void actionPerformed(ActionEvent arg0) {
if(arg0.getActionCommand() == "listado"){
ListaUsuarios lista = new ListaUsuarios();
textoListadoDeUsuarios.setText(lista.getTodosUsuarios());
textoListadoDeUsuarios.setEditable(false);
} else if(arg0.getActionCommand() == "listar trinos"){
List... |
290eeec3-7e13-467a-a230-1a791527c249 | 7 | public void receiveNewPose(double[] pose) {
for (int i = length - 1; i > 0; i--) {
time[i] = time[i-1];
poses[i] = poses[i-1];
}
time[0] = System.currentTimeMillis();
poses[0] = pose;
long time1 = 0;
long time2 = 0;
int mid = length / 2;
time1 = time[mid] - time[0];
time2 = time[length -... |
5dd9630b-61c8-4033-bcfe-efb1635c7dde | 8 | protected final void checkPaint() {
checkGC();
if (currentState.fgColor != null) {
if (!currentState.fgColor.equals(appliedState.fgColor)
&& currentState.fgPattern == null) {
gc.setForeground(appliedState.fgColor = currentState.fgColor);
}
}
LineAttributes lineAttributes = currentState.lineAttr... |
78f2ea16-06d3-49de-9182-7861718131fb | 4 | public static void main(String[] args)
{
if (args.length == 0) {
System.err.println("Usage: NTPClient <hostname-or-address-list>");
System.exit(1);
}
NTPUDPClient client = new NTPUDPClient();
// We want to timeout if a response takes longer than 10 seconds
... |
4e2a4bb2-b024-418a-9d61-a539f810e806 | 2 | public String getMimeType() {
if (format >= 0 && format < MIME_TYPE_STRINGS.length) {
return MIME_TYPE_STRINGS[format];
} else {
return null;
}
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.