method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
faad4fc7-f023-4c69-9de1-e41b1847273a | 6 | public void clickOnMouseLeftButton(Field logicField, GraphicCell gCell,
GraphicField gField) {
// GraphicCell graphicCell1 = gCell;
if (ActionCounters.getCounter() < GraphicField.NUMBER_OF_CELL
&& !Field.gameOver) {
Cell[][] array = logicField.getArray();
Cell cell = array[gCell.getgX()][gCell.... |
d4829e11-3159-4ff0-9f38-520c36279b36 | 6 | public String parseToString(SecondaryStructure ss1, SecondaryStructure ss2, Geometry gg) {
//return information needed in appropriate manner
String stRes = cutToSize(gg.getStart(), 12);
String endRes = cutToSize(gg.getEnd(), 10);
String type = "";
if(ss1.getSSType().equals("S")) { type += "B"; }
if(ss1.getSSTyp... |
2ca1f143-6f40-454a-9ff3-a8b9099a1753 | 1 | public void onRobotDeath(RobotDeathEvent event) {
// If the robot that has died was our target, remove it as the target
if (event.getName().equals(Observer.TARGET)) {
Observer.TARGET = null;
}
} |
14ce2b01-690b-4363-be10-4f8ad5ee9598 | 9 | public void endNode() {
depth-- ;
Node node = (Node)elementStack.pop();
if (node.clazz != null && node.isCollection) {
if (node.fieldAlready) {
readyForNewLine = true;
}
finishTag();
writer.write("]");
} else if (tagIsEmpty)... |
546a2a56-176b-46be-bd7c-da0b812fff31 | 4 | public static void UpperProducer(){
try {
if(conn == null || conn.isClosed()){
conn = DatabaseConnection.getConnection();
}
} catch (SQLException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
try{
conn.setAutoCommit(false);
PreparedStatement st... |
55b3daaa-b3d8-4d5c-8628-5f01d1deb41a | 1 | @Test
public void testSizeOfListInFile() throws IOException {
cm.addFutureMeeting(contacts, new GregorianCalendar(2015,3,2));
cm.addNewPastMeeting(contacts, new GregorianCalendar(2013,5,3), "meeting");
ObjectInputStream ois = new ObjectInputStream(new FileInputStream("contacts.txt"));
List inputData = null;
... |
bd36196f-dc44-4335-b39a-956279e41e26 | 7 | protected static boolean compareBiomesById(final int p_151616_0_, final int p_151616_1_)
{
if (p_151616_0_ == p_151616_1_)
{
return true;
}
else if (p_151616_0_ != BiomeGenBase.mesaPlateau_F.biomeID && p_151616_0_ != BiomeGenBase.mesaPlateau.biomeID)
{
... |
2a77b464-717b-4533-9cfe-0e66f2dccf4e | 4 | @Override
public Object getValueAt(int rowIndex, int columnIndex) {
switch (columnIndex) {
case 0:
return nameList.get(rowIndex);
case 1:
return regDateList.get(rowIndex);
case 2:
return lastLogDateList.get(rowIndex);
... |
01dbb305-5484-491a-98d0-4d04aa85aad1 | 4 | * @param active Whether or not the active version of the color is needed.
* @return The foreground color.
*/
public static Color getListForeground(boolean selected, boolean active) {
if (selected) {
Color color = UIManager.getColor("List.selectionForeground"); //$NON-NLS-1$
if (!active) {
Color backgro... |
82e45879-77a7-49eb-9479-ea8d3bdf2d5a | 1 | public String getStudentType(Student student) {
if (student.getCategory() == Student.Category.PRIMARIA)
return "PRIMARIA";
else
return "INFANTIL";
} |
5ead2b96-6a15-499c-a6ec-efa7abdcddf8 | 7 | static void testValidity(Object o) throws JSONException {
if (o != null) {
if (o instanceof Double) {
if (((Double)o).isInfinite() || ((Double)o).isNaN()) {
throw new JSONException(
"JSON does not allow non-finite numbers.");
... |
589870b3-0d9d-4531-858d-be410c6bb6a5 | 4 | private void updateSet(String line)
{
if(line.equalsIgnoreCase("SpriteSet"))
currentSet = Types.VGDL_SPRITE_SET;
if(line.equalsIgnoreCase("InteractionSet"))
currentSet = Types.VGDL_INTERACTION_SET;
if(line.equalsIgnoreCase("LevelMapping"))
currentSet = Typ... |
b62c3612-94d6-4041-b72c-93394a19caf4 | 7 | protected int widestDim(double[][] nodeRanges, double[][] universe) {
final int classIdx = m_Instances.classIndex();
double widest = 0.0;
int w = -1;
if (m_NormalizeNodeWidth) {
for (int i = 0; i < nodeRanges.length; i++) {
double newWidest = nodeRanges[i][WIDTH] / universe[i][WIDTH];
... |
45034f67-670c-4674-96f7-1d4670550820 | 4 | private static int[] getNextArray (String pattern) {
int size = pattern.length();
int[] next = new int[size];
next[0] = -1; // initialize nxet[0] = -1
if (size == 1) {
return next;
}
next[1] = 0; // if the length of pattern > 1, initialize next[1] = 0;
int j = 1;
int k = next[1];
while (j < si... |
ad84f497-5fad-4a3b-a11a-729cc8240952 | 2 | public ResourceType getResourceTypeByName(String name) {
ResourceType resourceType = null;
for (int i = 0; i < resourceTypes.size(); i++) {
resourceType = resourceTypes.get(i);
if (resourceType.getName().equals(name)) {
return resourceType;
}
... |
c5ead689-a494-4270-8949-6d6078472188 | 0 | public void setComment(String comment) {
this.comment = comment;
} |
dcb42769-bb01-4620-ba49-5183bf1da1ea | 7 | public Tile[][] generateZBlock()
{
Tile[][] piece = new Tile[3][2];
for (int i = 0; i < piece.length; i++)
for (int j = 0; j < piece[i].length; j++)
{
if ((i == 0 && j==0) || (i==1) || (i==2 && j==1))... |
41fac249-3f33-446d-8790-cb51a4b65562 | 8 | public static void main(String args[]) throws Exception {
/* Enter your code here. Read input from STDIN. Print output to STDOUT */
String input = null;
try {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
input = br.readLine();
} catch ... |
e69e8c06-4c86-4eef-acb1-8794efa4fc94 | 2 | @Override
public void toString(String indent, StringBuilder buffer)
{
int len = this.tags.size();
buffer.append("{ ");
for (Map.Entry<String, NamedBinaryTag> entry : this.getValue().entrySet())
{
buffer.append(entry.getKey()).append(": ").append(", ");
}
if (len > 0)
{
buffer.replace(buffer.leng... |
daf8b08d-b8f7-4aeb-b7e9-cdbcff775e14 | 5 | protected void handlePixelValue() {
System.out.println("PIXEL VALUE");
BufferedImage img = this.getBufferedImage();
int displayPixel = 0;
switch (displayedToolIndex) {
case 1:
displayPixel = img.getRGB((int)cover.getStartPoint().getX(), (int)cover.getStartPoint().getY());
break;
case 2:
int red=... |
653e051c-398a-42cd-9c78-279cb79b3efd | 7 | public void writeTermsToFile(String strNumber,
Hashtable<String, Double> oTermVsTFIDF) throws IOException {
String strKey = null;
Double maxValue = Double.MIN_VALUE;
String strTerms = "";
int len = oTermVsTFIDF.size() < 5 ? oTermVsTFIDF.size() : 5;
for (int i = 0; i < len; ++i) {
for (Map.Entry<Strin... |
a0239e95-28b0-480a-b031-60956bdd0044 | 5 | public byte [] readControl (byte type, byte request,
short value, short index, short length)
throws IOException
{
byte data [] = new byte [length & 0xffff];
int status;
if (length >= MAX_CONTROL_LENGTH
|| (type & ControlMessage.DIR_TO_HOST) == 0)
throw new IllegalArgumentException ();
if (Wind... |
ff821419-9965-4227-9442-e815966e4e16 | 2 | @Test
public void testTotalwithRemoveEveryThing(){
for (int i=0;i<3;i++){
Main.addToTable(originalItemList.get(i), 2);
}
for (int i=0;i<3;i++){
Main.removeFromTable(0);
}
assertEquals(0, Main.getTotal());
} |
0e5512c5-2843-41a1-bf12-eea78e2f6e39 | 1 | @Override
public Map<String, String> obtainUserRecord(String username) {
Map<String, String> userRecord = new HashMap<String, String>();
// Find an user record in the entity bean User, passing a primary key of
// username.
User user = emgr.find(entity.User.class, username);
// Determine whether the user exi... |
da3a10c4-46fa-4285-aea3-1ae4b97fd66c | 3 | public void addConfirmedUser(long uid) {
if(!this.isRemoving()) return;
this.aWaitingId.remove(uid);
if(this.aWaitingId.size()<=0) {
this.finalizeRemovalWithoutChecking();
}
else {
try
{
this.save();
} catch (SQLException e)
{
e.printStackTrace();
}
}
} |
079f123a-c31a-4ce0-bf18-bc9facefd8f4 | 9 | public void DBReadAllRooms(RoomnumberSet set)
{
final List<String> newAreasToCreate=new Vector<String>();
if(set==null)
DBReadAllAreas();
if(CMLib.map().numAreas()==0)
return;
final RoomnumberSet unloadedRooms=(RoomnumberSet)CMClass.getCommon("DefaultRoomnumberSet");
final Map<String,Room> rooms=DBRea... |
8a4b003b-007d-4a4e-81c9-b873d25a87a8 | 5 | @EventHandler(priority = EventPriority.NORMAL)
public void onDamage(EntityDamageEvent event)
{
if (event.getEntity() instanceof Player && event.getCause() != DamageCause.VOID && event.getCause() != DamageCause.LAVA && event.getCause() != DamageCause.FIRE)
{
Player player = (Player) event.getEntity();
if (B... |
411dcc5d-f58b-4def-9625-7380d2ab220f | 7 | @Override
public List<IProducto> filtrarProductos(List<IProducto> productos) {
Boolean hubo_coincidencias = true;
List<IProducto> prodsAplican = new ArrayList<IProducto>();
// productos que coinciden con un registro de la oferta
List<IProducto> productos_encontrados = new ArrayList<IProducto>();
// copia ... |
ca3758de-0c3b-45ef-ae01-35513c8a4c45 | 8 | public void populateRestaurantPriceMap(int restaurantId, String[] inputTokens) {
Restaurant res = restaurantMap.get(restaurantId);
boolean checkFlag = true;
int tokensLength = inputTokens.length;
for (int i = 1; i < tokensLength; i++) {
String item = inputTokens[i].trim();
Float price;
if (res.checkIte... |
ef7030dc-761c-4326-a94e-3e04563bfa54 | 5 | private static int findMatchingParenthesis(String regex, int index) {
int count = 0;
for (int i = index + 1; i < regex.length(); ++i) {
if (count == 0 && regex.charAt(i) == ')')
return i;
else if (regex.charAt(i) == '(')
++count;
else if (regex.charAt(i) == ')')
--count;
}
return -1;
} |
434b05a7-b99f-429e-b846-d241c41e7a77 | 7 | private void readStudentList(File file)
{
BufferedReader FILE;
try {
String currentLine;
FILE = new BufferedReader(new FileReader(file));
while ((currentLine = FILE.readLine()) != null) {
String[] arg = currentLine.split(",");
Student newStudent = new Student(Integer.parseInt(arg[0]));
newSt... |
34120e35-20f6-4f42-ab65-666e1ebab157 | 5 | private void voegOpdrachtToeAanQuiz() {
try {
if (!isToegevoegdeOpdracht(quiz.getOpdrachten(), quizWijzigenView
.getListOpdrachten().getSelectedValue())) {
for (Opdracht opdracht : opdrachtCatalogus.getOpdrachten()) {
if (opdracht.equals(quizWijzigenView.getListOpdrachten()
.getSelectedValue()... |
d2961366-37a7-4039-945e-c8a1e7957730 | 0 | public Set<String> getDownloadFileTypes(){
return this.downloadFileTypes;
} |
c911c029-1efa-4c6e-964b-6be3d01bba87 | 0 | public SQLPermissionGroup(String n) {
super(n);
} |
f5450478-0cbb-4c74-9e51-aad745ebb33e | 1 | public void apply() {
if (mStrategy != null) {
mStrategy.findElement();
}
} |
8a5955b9-b6c8-4865-9196-d877cb596b40 | 2 | @Override
public void Borrar(Object value) {
Session session = null;
try {
Liga ejecutivo = (Liga) value;
session = NewHibernateUtil.getSessionFactory().openSession();
session.beginTransaction();
session.delete(ejecutivo);
session.getTransa... |
eb0b220b-e069-4de8-8d83-d09494614144 | 3 | public static byte toByte(Object object) {
if (object instanceof Number) {
return ((Number) object).byteValue();
}
try {
return Byte.valueOf(object.toString());
} catch (NumberFormatException e) {
} catch (NullPointerException e) {
}
retur... |
2606f7a0-1f13-4e8a-8a93-8e8fd5e97fd8 | 1 | public void write8bytes(long n) throws IOException {
long b0 = n & 0xff;
long b1 = (n & 0xff00) >> 8;
long b2 = (n & 0xff0000) >> 16;
long b3 = (n & 0xff000000) >>> 24;
long b4 = (n & 0xff00000000L) >> 32;
long b5 = (n & 0xff0000000000L) >> 40;
long b6 = (n & 0xff000000000000L) >> 48;
long b7 = (n & 0xf... |
ccf6d1b7-6864-43d7-a527-639cd2cc27c3 | 1 | public int[] generate(int nplayers, int bowlsize) {
Random random = new Random();
int nfruits = nplayers * bowlsize;
int left = nfruits;
int[] dist = new int[12];
for (int i = 1; i < 11; i++) {
int cnt = random.nextInt(left);
dist[i] = cnt;
... |
d628d145-3e9f-4ce4-bf3d-f49defc716f7 | 8 | public void actionPerformed (ActionEvent ev)
{
//System.out.println(ev.getActionCommand());
// Clic BOUTON "Source"
if (ev.getActionCommand().equals(txtBtSource)) {actionBtSource();}
// Clic BOUTON "Dest"
else if (ev.getActionCommand().equals(txtBtDest)) {actionBtDest();}
// Action sur BT START
... |
0c033286-ab1e-4c4d-8ed8-90110b9213ef | 0 | public void addPayment() {
this.setTotal(this.getTotal()+this.calcPayment());
} |
c3e7f56c-53fb-480b-860a-34f5e3a8e760 | 5 | private static float pointIntersectsCircleOuterDetection(
float pointX, float pointY, float speedX, float speedY, float radius,
float outerCenterX, float outerCenterY, float outerRadius) {
// Rearrange the parameters to form the quadratic equation
double offsetPointX = pointX - oute... |
2b24525a-91d6-42f4-aaf1-65336d36a804 | 1 | public void visitForceChildren(final TreeVisitor visitor) {
if (visitor.reverse()) {
index.visit(visitor);
array.visit(visitor);
} else {
array.visit(visitor);
index.visit(visitor);
}
} |
594bd601-b68e-4960-8e10-2682994b8701 | 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... |
3afaf106-43b6-4981-bdbd-14cddc23ae2d | 7 | protected void setup() {
if(log.isLoggable(Logger.INFO))
log.log(Logger.INFO, "Hello World! This is Agent '" + getLocalName() + "'!");
world = new World();
new WumpusGUI(this).setVisible(true);
dfd = new DFAgentDescription();
dfd.setName(this.getAID());
/*
* Der Agen... |
fa8f19da-aeb2-410a-9fe7-61342d67121c | 1 | protected boolean isInt(Object obj) {
return (obj != null && obj instanceof Integer);
} |
ffd232b4-60fd-4686-a51d-fa93e108dba7 | 0 | public void addProduct(Product p) {
this.products.put(p.getCode(), p);
} |
3dd54db4-ecda-4894-a71d-9f322b106064 | 2 | public static int search_var_by_name(Variable_table variable_table, String name) {
int num = variable_table.variable_name.size();
for (int i = 0; i < num; i++) {
if (variable_table.variable_name.get(i).toString().equals(name)) {
return i;
}
}
retur... |
2cc35076-42a2-4249-935c-bfb0e54b5de1 | 0 | public void setDatetime(Date datetime) {
this.datetime = datetime;
} |
b7450797-9522-48d7-8595-d30abc681f57 | 7 | private void performDelete(Node z) {
// create a node pointer y
Node y;
// if z has no left or right subtree
if (z.left == null || z.right == null) {
// set y to z
y = z;
} else {
// set y as the successor of z
y = successor(z);
}
// create a node pointer x
Node x;
// if y has a left subt... |
0f338db4-5930-498e-89d1-5e455b9c7985 | 1 | public static String propertiesToString(BaseProperties props){
ByteArrayOutputStream baos = new ByteArrayOutputStream();
try {
props.store(baos, null);
} catch (IOException e) {
LOG.error("Caught IOException while trying to flush properties: " + e.getLocalizedMessage() + ... |
ff629f17-5590-4791-a018-6cf0855bbe0b | 3 | @Test
public void addsAndPopsLikeAGoodStack()
{
assertTrue(stack.pop() == 1 &&
stack.pop() == 11 &&
stack.pop() == 3 &&
stack.pop() == 2);
} |
1fa761b1-cdbf-4d66-a6f4-7764e1cd5a5e | 8 | Transaction openWrite(Transaction me) {
boolean cacheHit = false; // already open for read?
// not in a transaction
if (me == null) { // restore object if latest writer aborted
if (writer.isAborted()) {
rVersion.recover();
writer = Transaction.COMMITTED;
}
return null;
... |
f25f4c02-a95a-4827-aef0-2232cb5786d4 | 4 | public synchronized static LinkedList<Theater> getAllTheaters(int zone){
if(theaters.size() == 0)
return null;
LinkedList<Theater> result = new LinkedList<Theater>();
for(Theater t : theaters)
if(t.getZone() == zone)
result.add(t);
if(result.size() == 0)
return null;
return result;
} |
06552e3b-63c0-4098-a710-bed40384ec14 | 7 | public void CheckDyeCape() {
boolean GoOn = true;
int CapeXP = 0;
int NewCape = -1;
switch (useitems[0]) {
case 1763: //red dye
NewCape = 1007;
CapeXP = 2;
case 1767: //blue dye
NewCape = 1021;
CapeXP = 2;
case 1765: //yellow dye
NewCape = 1023;
CapeXP = 2;
case 1771: //green... |
03dd1e78-59d6-44ca-9239-203502f380f0 | 2 | public void clearLevel(int no)
{
for (int i=0; i<height; ++i) {
for (int j=0; j<width; ++j) {
stack[i][j].setLayer(no, null);
}
}
} |
327ba831-780c-4d45-96ff-cc5078b0f067 | 0 | @Override
public String getDesc() {
return "HolyCrossAttack";
} |
39acf240-e60e-410d-b054-1d35501d2af2 | 0 | public void setFunApellidos(String funApellidos) {
this.funApellidos = funApellidos;
} |
2cfebabc-1ebc-4310-8f28-098bb87a9249 | 7 | @Override
protected void paintComponent(Graphics g)
{
super.paintComponent(g);
// Invoke the painter for the background
if (painter != null)
{
Dimension d = getSize();
Graphics2D g2 = (Graphics2D) g;
g2.setPaint(painter);
g2.fill( new Rectangle(0, 0, d.width, d.height) );
}
// Draw the im... |
8b5eebd1-b89f-43d4-8a52-dc904154d298 | 8 | public boolean isAnyLiquid(AxisAlignedBB par1AxisAlignedBB)
{
int var2 = MathHelper.floor_double(par1AxisAlignedBB.minX);
int var3 = MathHelper.floor_double(par1AxisAlignedBB.maxX + 1.0D);
int var4 = MathHelper.floor_double(par1AxisAlignedBB.minY);
int var5 = MathHelper.floor_double(... |
bda5b437-2809-4fef-9bba-8f925cf24c1c | 8 | private void factor() {
int n = R.numRows();
// Internal CRS matrix storage
int[] colind = R.getColumnIndices();
int[] rowptr = R.getRowPointers();
double[] data = R.getData();
// Temporary storage of a dense row
double[] Rk = new double[n];
// Find the... |
af4d9db3-189d-49c7-9d07-116a119e2e09 | 9 | private void drawCloudMap(Graphics graphics) {
BufferedImage buffer = new BufferedImage(getWidth(), getHeight(),
BufferedImage.TYPE_INT_RGB);
Graphics gr = buffer.getGraphics();
for (int x = 0; x < mapWidth; x++) {
for (int y = 0; y < mapHeight; y++) {
double emptyAverage = 1;
for (int t = 0; t < c... |
c3c7b77a-b252-4b1a-a6da-c187403623a6 | 9 | public static String getMergeSql(String table, String colnames, String keynames) {
StringBuilder sb = new StringBuilder();
sb.append("MERGE INTO " + table + " a ");
sb.append(" USING (SELECT ");
String[] colnamelist = colnames.split(",");
for (int i = 0; i < colnamelist.length; i++) {
String col = colnamel... |
78473bde-dfec-45ee-a811-69160b8fd2d2 | 1 | public void SetMaximumPassenger(int maximumPassenger)
{
if(maximumPassenger > this.maximumPassenger)
this.maximumPassenger = maximumPassenger;
} |
16d49733-46bb-47d1-a341-abece80f6e18 | 7 | public void deadRemoval() {
ArrayList<Integer> dead = new ArrayList<Integer>();
int i = 0;
for (Asteroid a : asteroids) {
if (!a.getAlive()) {
dead.add(i);
}
i++;
}
i = 0;
for (int d : dead) {
asteroids.remov... |
573c864d-ed2d-4c1e-84c6-554ec82127a8 | 5 | public void actionPerformed(ActionEvent e) {
String nick = GUIMain.userList.getSelectedValue().toString();
if (nick.startsWith("@")) {
nick = nick.replace("@", "");
} else if (nick.startsWith("$")) {
nick = nick.replace("$",... |
d1fadb1c-5af9-4aae-ac6c-66e9cf0b89ba | 2 | public static void insertCarte(Carte carte) {
PreparedStatement stat;
try {
stat = ConnexionDB.getConnection().prepareStatement("insert into carte (serialNumber) values (?)");
stat.setString(1, carte.getSerialNumber());
stat.executeUpdate();
} catch (SQLEx... |
7aec367d-682d-4d73-99a8-ce208181e5a1 | 3 | public void initializeConverter(Automaton automaton) {
MAP = new HashMap();
State[] states = automaton.getStates();
State initialState = automaton.getInitialState();
// Do the variables.
VARIABLE = new LinkedList();
for (char c = 'A'; c <= 'Z'; c++)
VARIABLE.add("" + c);
// Map the initial state to S.
... |
f56f8a82-c852-4407-a591-07ecaca2e6d0 | 1 | @Override
public void setNull(int intId, String strTabla, String strCampo) throws Exception {
Statement oStatement;
try {
oStatement = (Statement) oConexionMySQL.createStatement();
String strSQL = "UPDATE " + strTabla + " SET " + strCampo + " = null WHERE id = " + Integer.toS... |
97a3cef3-0f2d-4552-99b5-3e597d63bd72 | 0 | private ServiceManager()
{
} |
3fc326d7-e088-4845-be21-cfee67362fe7 | 6 | public RuleBased(GenData gen) throws IOException{
this.data = gen;
writer = new BufferedWriter(new FileWriter("featureMatrix.txt"));
y = new BufferedWriter(new FileWriter("label.txt"));
for(User u:data.userMap.values()){
u.addDiffFeature();
for(int i=0; i<featuresize; i++){
if... |
c29fe417-e98c-42ae-abfd-dde3de28284d | 4 | public boolean isIn(double x1, double y1){
if ((x <= x1) && (x1 <= (x + length)) && (y <= y1) && (y1 <= (y + height)) ){
return true;
}else return false;
} |
682552c8-ff1d-4c58-885d-dfb0f84714f1 | 6 | public void AddPoint(double x, double y, int index) {
if (index > PointArray.length - 1) {
index = PointArray.length;
} else if (index < 0) {
index = 0;
}
double temp[] = new double[PointArray.length + 2];
for (int i = 0; i <= temp.length - 1; i++) {
... |
35f4e217-cdfd-4c13-ac5c-84f7c3428edf | 3 | private void lifeCycle() {
String s = "";
int attempt_number = 0;
do {
try {
s = readInput();
if (s.length()==0) {
break;
}
action(s);
attempt_number++;
} catch (IOException e) {
e.printStackTrace();
}
} while (attempt_number<=VALUE_ITERATIONS_NUMBER-1);
... |
a60f4eb6-1ece-405e-974d-7bb75ad4ea19 | 5 | private String fontTypeToString(int fontType) {
if (fontType == FONT_OPEN_TYPE) {
return "Open Type Font";
} else if (fontType == FONT_TRUE_TYPE) {
return "True Type Font";
} else if (fontType == FONT_TYPE_0) {
return "Type 0 Font";
} else if (fontTyp... |
f3396002-7bf0-4b39-a140-fb5f2ae52e6a | 9 | @Override
public String toString() {
StringBuilder buf1 = new StringBuilder();
if (isPrinter()) {
for (MoneyPrinter printer : printers) {
buf1.append(printer.toString());
}
}
StringBuilder buf2 = new StringBuilder();
if (isParser()) {
... |
0b7dc43a-2bd9-47b4-af1b-e2010aed1c47 | 9 | public void update()
{
shift = (int) (Math.random()*4);
if (Math.random() < .5)
{
for (int i = 0; i < shift;i++)
{
if (!collisionCheck(getX() + 1,getY())) addX(1);
else break;
}
}else
{
for (int ... |
4d07152e-77bf-45de-998e-16832b778692 | 9 | public void cal(int x, int y, int m, int n, int[][] matrix) {
if (n <= 0 || m <= 0) return;
for (int i = 0; i < n; i++)
res.add(matrix[x][i + y]);
for (int i = 1; i < m; i++)
res.add(matrix[x + i][y + n - 1]);
for (int i = 1; i < n; i++)
if (x + m - 1 ... |
09415101-5744-49ec-9788-4895109469d1 | 1 | public void broadCast(String s){
for (BTHandler h:this.handler){
h.send(s.getBytes());
}
} |
ba532d40-11da-4069-a483-6fd04c1b7f81 | 0 | public int getExperience() {
return experience;
} |
00ce3917-ad4c-4c03-ac5f-3156f082630a | 7 | public String toString() {
switch (typecode) {
case TC_LONG:
return "long";
case TC_FLOAT:
return "float";
case TC_DOUBLE:
return "double";
case TC_NULL:
return "null";
case TC_VOID:
return "void";
case TC_UNKNOWN:
return "<unknown>";
case TC_ERROR:
default:
return "<error>";
}
... |
79c0044c-7913-4e39-9f3c-c937e1faefe6 | 4 | private boolean onJonkinMuunPalikanVieressa(Sijainti sijainti)
{
if(palikat.isEmpty())
return true;
for(Palikka palikka : palikat)
if(palikka != null && onVieressa(((TetriminoPalikka)palikka).sijainti(), sijainti))
return true;
return false;
... |
16505961-6566-4d5a-b427-fdb0b0c5a871 | 3 | public void build() {
for (Field f : this.bagFields) {
try {
Object value = f.get(this);
if (value != null) {
ResourceBag.class.cast(value).build();
}
} catch (IllegalAccessException e) {
throw new Runtim... |
51c0c4a9-155f-4725-8eb3-5fbd9e1ac8af | 5 | private Node fixUp(Node h) {
if (isRedNode(h.right))
h = rotateLeft(h);
if (isRedNode(h.left) && isRedNode(h.left.left))
h = rotateRight(h);
if (isRedNode(h.left) && isRedNode(h.right))
flipColors(h);
return h;
} |
5643b4dd-5164-4168-90d3-c58fbf218200 | 6 | public void listenSocket()
{
try
{
server = new ServerSocket( 80 );
}
catch( IOException e )
{
System.out.println( "Could not listen on port 80" );
System.exit( -1 );
}
while( true )
{
try
{
client = server.accept();
}
catch( IOException e )
{
System.out.println( "Accep... |
e607c6e8-ee36-4d6c-a6d8-8b5f82afaf1a | 1 | public String getTripFrom() {
if (river == null)
return "<?>";
return river.getTripFrom();
} |
a1d51a42-a451-43bb-ba5a-a3ff7a58afa2 | 1 | @Override
protected DataSet doParse() {
try {
return doFixedLengthFile(getDataSourceReader());
} catch (final IOException e) {
LOGGER.error("error accessing/reading data", e);
}
return null;
} |
796af123-f4e9-4a00-b61a-5de149300d9d | 4 | public void computeLCS()
{
int diag = 0;
for (int i = 1; i < seq1.length; i++) {
diag = 0;
for (int j = 1; j < seq2.length; j++) {
diag = length[j];
if (seq1[i] == seq2[j]) {
length[j] = length[j] + 1;
} else... |
4413a18f-258e-4866-9e9e-38cbf34e2164 | 0 | public void setMusicLoudness(MusicLoudness musicLoudness) {
this.musicLoudness = musicLoudness;
} |
782d37ca-15c2-4c5e-a050-757f493e5785 | 7 | private void setStationType(Player player) {
//
List<TicketType> ticketTypes = new ArrayList<TicketType>();
// gets all the possible edges the player can transverse given their current node and loops through them
for (Edge a : player.getNodeNeighbours()) {
// adds each edge type to the ticketTypes list
if... |
bea96ad4-a9f2-45b2-8a06-17207c83a303 | 6 | public boolean intersectsBelow(RPChromosomeRegion testRegion) {
// Only need to test if some part of this region is below and some within test region.
if (startChromID < testRegion.startChromID ||
(startChromID == testRegion.startChromID && startBase < testRegion.startBase)) {
... |
b6c0307d-1eef-4de5-bd57-076b3d797bc9 | 9 | static final void method3012(int i, int i_44_, int i_45_, int i_46_,
int i_47_, byte i_48_, int i_49_, int i_50_) {
anInt6918++;
int i_51_ = 0;
int i_52_ = i;
int i_53_ = 0;
int i_54_ = -i_50_ + i_45_;
int i_55_ = -i_50_ + i;
int i_56_ = i_45_ * i_45_;
int i_57_ = i * i;
int i_58_ = i_54_ * i_54_;
int i_... |
a3a75947-51c3-4744-8635-e9d12770064d | 2 | public CompilationUnit getCompilationUnit(Lexer lexer) {
for (CompilationUnit unit: units) {
if (unit.getLexer().equals(lexer))
return unit;
}
return null;
} |
63ce86ef-2c20-4e5a-91c4-2417d838d844 | 1 | public static HttpServletRequest addBill(HttpServletRequest request){
Models.DatabaseModel.Bill bill = new Models.DatabaseModel.Bill();
Models.DatabaseModel.Patient patient = new Models.DatabaseModel.Patient();
int patientID;
if (request.getParameter("patientID") == null){
pa... |
cde92478-a84c-40d4-a32c-9c607ec2c5f9 | 4 | public static String encryptMD5(String pwd) {
try {
MessageDigest md = MessageDigest.getInstance("MD5");
md.update(pwd.getBytes());
StringBuffer stringBuffer = new StringBuffer();
int n;
byte[] b = md.digest();
for (int i = 0; i < b.length; i++) {
n = b[i];
if (n < 0) {
... |
4ebf4ceb-707d-439e-9379-ec248c4c3090 | 0 | public Chromo<T> getFittestChromo() {
return new Chromo<>(fittestChromo.getGenes(), fittestChromo.getFitness());
} |
fdbed5a7-1875-4c4c-9869-3f12030b7f8c | 7 | public boolean equals(Object o) {
if (!(o instanceof Map.Entry))
return false;
Map.Entry e = (Map.Entry)o;
Object k1 = getKey();
Object k2 = e.getKey();
if (k1 == k2 || (k1 != null && k1.equals(k2))) {
Object v1 = getValue();
Object v2 = e.getV... |
9af19741-4180-4fc4-ac3e-b31ba2d07805 | 8 | public Set<Map.Entry<Double,Integer>> entrySet() {
return new AbstractSet<Map.Entry<Double,Integer>>() {
public int size() {
return _map.size();
}
public boolean isEmpty() {
return TDoubleIntMapDecorator.this.isEmpty();
}
... |
1852eab4-8c2a-4320-95d6-b0e52f18078a | 0 | public void addServiceListener(IServiceListener listener)
{
this._listeners.add(listener);
} |
ad49bde7-3976-420a-a524-afdf096e5ce3 | 8 | public Response signup(Response resp, JSONObject data)
{
try
{
if(data.has("name") && !v.isNullOrEmpty(data.getString("name")) && data.has("email") && v.isValidEmail(data.getString("email")) && data.has("website") && v.isValidURL(data.getString("website")))
{
User user = UserDAO.instance().get(d.hashe... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.