method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
23142e10-6c42-4661-a8ec-d34cb7211bad | 7 | protected synchronized void shutdown(){
if(input!=null)
try {input.close();}catch(IOException eio1){}
if(output!=null)
try {output.close();}catch(IOException eio2){}
if(socket!=null)
try {socket.close();}catch(IOException eio3){}
input=null;
output=null;
... |
45e97e1e-2f92-4212-8977-61efd8807f7a | 0 | public String diaDaSemana(){
int totalDias = contaDias();
totalDias = totalDias % 7;
return nomeDiaDaSemana[totalDias];
} |
c2fb3110-5191-4cdb-9627-c313c5eb7f57 | 3 | public Item getRodType()
{
Item test=new Item(Item.Type.SUPER_ROD,1);
if(Inventory.hasItem(test))
return test;
else
{
test=new Item(Item.Type.GOOD_ROD,1);
if(Inventory.hasItem(test))
return test;
else
{
test=new Item(Item.Type.OLD_ROD,1);
if(Inventory.hasItem(test))
return test... |
59ba97e8-256b-49f1-a3d8-10d135fe88b3 | 0 | public void setVisible(boolean b){
frame.setVisible(b);
} |
9ce61c8d-5a84-4af1-a7b9-0e6f35870888 | 1 | public void setDifficulte(int difficulte) {
if(difficulte>0){
super.setDelay(1000/difficulte);
this.difficulte = difficulte;
}
} |
e9635e78-1a1a-40b8-8fff-77cac7bf5dab | 1 | public String getShortestPathTo_S(Node target) {
if(this.distance[target.getId()] == INFINITY)
return "not connected";
return String.valueOf(this.distance[target.getId()]);
} |
9fc29463-2bc3-41a7-8b9c-e0bac337ef69 | 0 | public boolean isLoaded() {
return (boolean)(sample != null);
} |
35e39d98-c846-46c1-a887-3b65313668e8 | 2 | public Persistent LoadObjectById(Long id, Persistent obj) throws IllegalAccessException
{
NodeReference node = connection.createNodeReference(obj.GetStorageGlobalName());
InitSchema(obj);
node.setSubscriptCount(0);
node.appendSubscript(id);
Field field;
... |
b00c2c60-f51b-4b52-a21f-0b3680ca724d | 4 | public static Matrix[] sampleWithReplacement(Matrix features, Matrix labels, int n) {
if (features == null || labels == null || features.getNumRows() != labels.getNumRows()) {
throw new MLException("No training data or size mismatch.");
}
Matrix matrices[] = new Matrix[] { new Matrix... |
2b163e11-b8f6-45c5-a188-63f481908fff | 7 | @Override
public Response serve( String uri, String method, Properties header, Properties parms ) {
String calledMethod = parms.getProperty("method");
String key = parms.getProperty("key");
String callback = parms.getProperty("callback");
Response r;
if(uri.equals("/api/call") && calledMethod.equals("remo... |
672db99a-73ae-417c-9e62-73192c196491 | 2 | public double convertTo(LengthUnit toUnit, double value) {
double _value = value;
if (this == PRIMARY) {
if (toUnit == PRIMARY)
return value; // Avoid multiplying by 1.0 needlessly.
} else {
_value = value / this.scaleFactor; // Convert to primary unit.
}
return _value * toUnit.scaleFactor; // Conve... |
2af926f6-5750-4a1d-a22f-1d1af3d28e00 | 6 | public static void main(String[] args) {
int epsilon = 3;
System.out.println("Epsilon: "+epsilon);
ArrayList<Point> points = new ArrayList<Point>();
Random r = new Random();
for (int i = 0; i < 21; i++) {
points.add(new Point(r.nextInt(10),r.nextInt(10)));
... |
d0426b04-3c4f-46bc-a6c9-7c2addcccdbb | 2 | public void setDAO(String daoLine) {
if (daoLine.equals("Mock")) {
dao = new MockDAO();
}
else if (daoLine.equals("MySQL")) {
dao = new MySQLDAO();
}
} |
c80dc153-9f1f-40de-9f49-15123e0737cb | 0 | public static String escapeXMLText(String text) {
text = StringTools.replace(text, "&", "&");
text = StringTools.replace(text, "<", "<");
text = StringTools.replace(text, "]]>", "]]>");
return text;
} |
ad3e1164-0734-4dcc-b785-c8f754c0d702 | 7 | static private int jjMoveStringLiteralDfa1_0(long active0)
{
try { curChar = input_stream.readChar(); }
catch(java.io.IOException e) {
jjStopStringLiteralDfa_0(0, active0);
return 1;
}
switch(curChar)
{
case 32:
return jjMoveStringLiteralDfa2_0(active0, 0xc30L);
case 69:
... |
49e4b75a-98c5-4c9d-b47a-03006fdb7050 | 0 | @Override
public Object clone() throws CloneNotSupportedException {
Student1 student1 = (Student1)super.clone();
student1.setT1((teacher)student1.getT1().clone());
return student1;
} |
1f4c27db-6b5f-4ebd-b5c8-ea7dd85b6c32 | 7 | private void createLab(int x, int y) {
walkways[x][y] = true;
ArrayList<Node> dirs = new ArrayList<Node>();
if (x > 1) dirs.add(new Node(x-1, y));
if (y > 1) dirs.add(new Node(x, y-1));
if (x < width - 2) dirs.add(new Node(x+1, y));
if (y < height - 2) dirs.add(new Node(x, y+1));
Collections.shuffle(di... |
3620f67c-2679-4b73-b6e3-c5da7552a565 | 8 | public void initNextButton() {
frame.getNextButton().setOnAction(new EventHandler<ActionEvent>() {
@Override public void handle(ActionEvent actionevent) {
try {
if (step) {
if (index < commands.size()) {
parseLine(commands.get(index));
String skipcheck = commands.get(index).substring(0... |
0ba81a88-552b-4805-93e3-5cceff18379b | 1 | public List<ACommand.Wrapper> makeCommandWrappers(List<ACommand.Executor> executors) {
List<ACommand.Wrapper> cmdList = new ArrayList<ACommand.Wrapper>(executors.size());
for(ACommand.Executor exec : executors) {
ACommand.Wrapper ecmd = new ACommand.Wrapper(exec);
cmdList.add(ecmd);
}
return cmdList;
} |
c53b4018-b531-4e8a-93cd-bf14a469cd22 | 9 | protected static int handleResponseCode(HttpURLConnection connection)
throws RestResourceException {
try {
int status = connection.getResponseCode();
String url = connection.getURL().toString();
String method = connection.getRequestMethod();
if (status == UNAUTHORIZED_ACCESS)
throw new Unauthorized... |
e32bdfa3-c635-48af-9c05-ef71e13b7419 | 3 | private void actionOpenFile () {
int res = fileChooser.showOpenDialog( this );
if ( res == JFileChooser.APPROVE_OPTION ) {
File file = fileChooser.getSelectedFile();
try ( BencodeInputStream bin = new BencodeInputStream( file ) ) {
Value<?> val = bin.readValue();
tree.setModel( new BencodeTreeModel( v... |
371fe10c-68bb-4ccd-b095-ccb648dea0e5 | 2 | public static Error findByCode(int code) {
for (Error e : Error.class.getEnumConstants()) {
if (e.getCode() == code) {
return e;
}
}
throw new IllegalArgumentException("Unknown " + Error.class.getName() + " enum code:" + code);
... |
afbf46fb-8888-43f9-8167-04dff7524c65 | 5 | @Override
public void run() {
try {
selector.selectNow();
for (SelectionKey selectionKey : selector.selectedKeys()) {
if (selectionKey.isAcceptable()) {
accept(); // Accept a new connection.
}
if (selectionKey.isReadable()) {
sessionMap.get(selectionKey).incomingCycle();
}
}
} ca... |
afb43ed3-1d4e-4ae3-8cf9-97733382d9b3 | 7 | public double bestEqual(String string, Object patterns, boolean equality) {
String[] array;
double value = Double.POSITIVE_INFINITY;
if (patterns instanceof String[]) {
array = (String[]) patterns;
} else if (patterns instanceof Collection) {
Collection<?... |
c91607ec-6b3e-412d-9ff4-ef2294b1874b | 8 | @Override
public Matrix gauss(Matrix matrix) {
isValid(matrix);
//prepare result
Matrix result = new Matrix(matrix);
for (int diagPos = 1; diagPos < Math.min(matrix.getRows(), matrix.getColumns()) + 1; diagPos++) {
long value;
//find column with pivot, sw... |
21c2f1b4-7465-4e63-a262-3bc226a8dad4 | 1 | private JLabel getJLabel2() {
if (jLabel2 == null) {
jLabel2 = new JLabel();
jLabel2.setText("CREATE CSV");
}
return jLabel2;
} |
75c0c6b3-8beb-4766-aec4-5bdcfc4b2417 | 9 | private void readDict (Range r) {
// System.out.println("reading dictionary from "+r.getStart()+" to "+r.getEnd());
pos = r.getStart ();
while (pos < r.getEnd ()) {
int cmd = readCommand (false);
if (cmd == 1006) { // charstringtype, default=2
charstringty... |
9a51250d-3e78-47df-a43f-7416fa5a4a83 | 2 | public static Boolean getBoolean(String key){
String str = props.getProperty(key);
if(MyStringUtil.isBlank(str)){
return false;
}
return Integer.valueOf(str.trim()) > 0 ? true : false;
} |
e00fb3b3-ff85-4f14-9cb2-9bab65f98172 | 0 | public void displayError(String error) {
output.setForeground(Color.red);
JOptionPane.showMessageDialog(this, error, "Error", JOptionPane.ERROR_MESSAGE);
output.setForeground(Color.black);
} |
267c6ebc-8625-4a7e-a4ce-5cc9b7748b4a | 7 | @Override
public void update(Observable o, Object arg) {
if(o instanceof Othello && arg instanceof Player) {
addPlayerView((Player)arg);
} else if(o instanceof Othello && arg instanceof String && arg.equals("clearGame")) {
for(PlayerView pv : playerViews) {
remove(pv);
}
... |
fbb44a3d-40d3-4f38-961d-7ca9c182afcc | 9 | protected void appendHitUpdate2(stream str) {
try {
str.writeByte(hitDiff); // What the perseon got 'hit' for
if (hitDiff > 0 && newhptype == false && poisondmg == false) {
str.writeByteA(1); // 0: red hitting - 1: blue hitting
} else if (hitDiff > 0 && poisondmg == true) {
str.writeByteA(0); // 0:... |
c3a50f9c-f79e-4201-8681-68bde6349b87 | 6 | private void configureRecipientDefaults() {
final ConfigurationSection main = Main.configurationFile.getConfig();
if (!main.isSet("timestamp")) return;
final ConfigurationSection section = main.getConfigurationSection("timestamp");
if (section.isSet("format")) {
final Strin... |
57492234-072d-4fd0-8d8d-091218c3e70a | 2 | private boolean isInputValid() {
boolean valid = vTxtGeneration.isInputValid();
if (vTxtRule.isEnabled() && !vTxtRule.isInputValid()) {
valid = false;
}
return valid;
} |
1e3f18a4-2df8-4e5b-ab6b-1fb66626ee9c | 0 | public void setPcaEstado(String pcaEstado) {
this.pcaEstado = pcaEstado;
} |
21132624-bcb8-4171-8816-f4b9c828b6cc | 3 | private void take(Command command) {
if (!command.hasSecondWord()) {
System.out.println("Take what?\n");
return;
}
String name = command.getSecondWord();
Item item = player.getLocation().getItem(name);
double freeCapacity = player.getCapacity() - player.ge... |
707b9409-844d-4305-b69e-331b248158b3 | 0 | public String getTelefono() {
return telefono;
} |
f9460b4d-24bd-4af8-aa05-0cb2f2160170 | 6 | private static void checkFirstSkipTo(final Query q, final IndexSearcher s) throws IOException {
//System.out.println("checkFirstSkipTo: "+q);
final float maxDiff = 1e-5f;
final int lastDoc[] = {-1};
final IndexReader lastReader[] = {null};
s.search(q,new Collector() {
private Scorer scorer;
... |
ffa058cc-47f6-4e61-8bb0-026a99853f45 | 9 | @Override
public boolean equals(Object object) {
// TODO: Warning - this method won't work in the case the id fields are not set
if (!(object instanceof ItemPropertyPK)) {
return false;
}
ItemPropertyPK other = (ItemPropertyPK) object;
if ((this.name == null && ot... |
022bd74d-e7f6-46af-909d-13bd559630ac | 5 | public boolean getBookByUniqueId(IssueBookVO issueBookVO)
throws LibraryManagementException {
boolean returnValue = true;
ConnectionFactory connectionFactory = new ConnectionFactory();
Connection connection;
try {
connection = connectionFactory.getConnection();
} catch (LibraryManagementException e) {
... |
122807fc-7ff7-4a14-adc7-bde187752cf9 | 2 | public double[] rawPersonStandardDeviations(){
if(!this.dataPreprocessed)this.preprocessData();
if(!this.variancesCalculated)this.meansAndVariances();
return this.rawPersonStandardDeviations;
} |
6734b239-d32a-4abd-9d90-4e25ff40c5d6 | 8 | Map<Integer, Candidate> parseFileForHistory(String fileName) throws IOException, NumberFormatException {
Map<Integer, Candidate> history = new HashMap<>();
Properties props = new Properties();
FileInputStream fis = new FileInputStream(fileName);
props.load(fis);
Enumerat... |
0c8e4c5b-71d4-4530-92bd-f2a599e2dcfe | 8 | public static List<List<Character>> comb(int k, List<Character> list) {
List<List<Character>> result = new ArrayList<List<Character>>();
Set<Character> visited = new HashSet<Character>();
if (k > list.size() || k <= 0)
return result;
if (k == 1) {
for (Character ... |
9e98db38-935e-4521-a079-3092c7b32807 | 5 | final int _compileIndex_(final String string) {
if ((string == null) || string.isEmpty()) return -1;
final char symbol = string.charAt(0);
if ((symbol < '0') || (symbol > '9')) return -1;
try {
return Integer.parseInt(string);
} catch (final NumberFormatException e) {
return -1;
}
} |
47162bc1-baa5-4310-a59b-c8ca7ace70de | 6 | @Override
public ResultadoAvaliacoes resultadoAvaliacoes(String refeicao, String data) {
Iterator<Avaliacao> avs = avaliacoes.values().iterator();
ResultadoAvaliacoes result = new ResultadoAvaliacoes();
result.setData(data);
result.setDesgostaram(0);
result.setGostaram(0);
result.setIndiferente(0);
... |
e456444a-c5e7-4c0a-948d-3801189317c9 | 4 | @Override
protected void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
String action = request.getParameter("action");
//由context parameter取得JDBC需要的資訊
ServletContext sc = this.getServletConfig().getServletContext();... |
cca94176-4c25-4d4b-83bc-fea821cf70ee | 7 | Instantiation(final Instantiation prev, final Subroutine sub) {
previous = prev;
subroutine = sub;
for (Instantiation p = prev; p != null; p = p.previous) {
if (p.subroutine == sub) {
throw new RuntimeException("Recursive invocation of " + sub);
}
}
// Determine the label to return to when ... |
a6a7a325-0bf8-44ef-9a63-85eb23580406 | 8 | public String[] get_status(int id, String phone, int all)
{
String[] m = {};
String tmp;
try {
m = _smsc_send_cmd("status", "phone=" + URLEncoder.encode(phone, SMSC_CHARSET) + "&id=" + id + "&all=" + all);
if (SMSC_DEBUG) {
if (m[1] != "" && Integer.... |
dbc9e7ae-fb35-40e7-b6ab-0b1d029dc174 | 0 | public TiltCycleDistance(boolean forward,double power) {
super(power, Distance.NEAR);
_forward = forward;
} |
73346916-a02b-4a3e-9900-8a6b04b995b4 | 1 | @Override
public int getFirstSlotLocationY() {
return isNotPlayerInventory() ? centerY - 19 : centerY + 14;
} |
e9081661-f488-47c7-8357-3184bc6553d6 | 1 | public static void main1(String[] args) {
EventQueue.invokeLater(new Runnable() {
@Override
public void run() {
try {
JFrame frame = new JFrame();
frame.setBounds(100, 100, 800, 600);
frame.setVisible(true);
HelpScherm ko = new HelpScherm(new MainWindow(null));
frame.setContentPane(... |
0100e6a0-130a-411e-b781-0185ed6e5db7 | 8 | public SimpleHTTPRequest2 doPost() {
if (this.madeRequest) {
throw new IllegalStateException("Already made request");
}
this.madeRequest = true;
HttpURLConnection connection = null;
InputStream is = null;
try {
connection = this.getConnection();
connection.setRequestMethod("POST");
connection.se... |
7a54409d-f82a-4356-a5a2-ec1ce57f198d | 8 | public static void main(String[] args) {
Scanner in = new Scanner(System.in);
PrintWriter out = new PrintWriter(System.out);
int N = in.nextInt();
long[] cards = new long[N];
for (int i = 0; i < N; i++)
cards[i] = in.nextLong();
if (... |
21dc9de5-45e1-4845-9389-0e4222db7c35 | 8 | public CompoundPredicate(Element compoundP,
MiningSchema miningSchema) throws Exception {
// Instances totalStructure = miningSchema.getFieldsAsInstances();
String booleanOpp = compoundP.getAttribute("booleanOperator");
for (BooleanOperator b : BooleanOperator.values()) {
if (b.... |
22eaab62-6010-41bc-bca8-7b530e95e60b | 3 | public static void benchmarkFloatLargeArrayNativeInANewThread()
{
System.out.println("Benchmarking FloatLargeArray native in a new thread.");
final long length = (long) Math.pow(2, 32);
long start = System.nanoTime();
final FloatLargeArray array = new FloatLargeArray(length);
... |
ccc11a8d-c48e-4803-b3b6-8ef4f8cf872d | 5 | public void createShipments() {
ArrayList<ArrayList<OrderLine>> shipmentList = new ArrayList<ArrayList<OrderLine>>();
for (OrderLine singleLine : this.myLines) {
boolean inserted = false;
System.out.println(singleLine);
for (ArrayList<OrderLine> list : shipmentList) {
if (splitter.IsSa... |
4d28af51-a689-42f1-8546-4b393c7cbe21 | 1 | @Test
public void testCreatingContactWithNullFirstNameShouldFail() {
try {
new Contact(null, "Smith", phoneNumber);
fail("Was expecting an Exception when no first name is provided.");
} catch (IllegalArgumentException iae) {
Assert.assertEquals("Please provide a value for First Name as it is a non-nullabl... |
59b51fd1-8120-48f4-89b5-a71749767e5f | 0 | public String getBday() {
return bday;
} |
8c3d703a-c6da-4a8e-8920-26e101e197cd | 4 | @Override
public void onUpdate(World apples) {
if (!apples.inBounds(X, Y)||apples.checkCollision(X, Y)||life++>7)
{
alive = false;
//apples.explode(X, Y, 32, 8, 16);
}
if (next++>2)
{
next = 0;
yspeed+=gravity;
}
... |
3b790480-01cc-49ea-9a25-47ea16c8dba4 | 2 | private ConfigNode[] excludeMessages(ConfigNode[] nodes) {
List<ConfigNode> newNodes = new ArrayList<ConfigNode>();
for(ConfigNode node : nodes)
if(!node.getNode().startsWith("actions."))
newNodes.add(node);
return newNodes.toArray(new ConfigNode[newNodes.size()]);
} |
b8dcacff-55e1-46ad-b96c-b412ba96593f | 5 | @Override
public boolean execute(CommandSender sender, String identifier,
String[] args) {
String playerName = args[0];
String titleId = args[1];
if (sender instanceof Player) {
try {
if (!DBManager.idExist(titleId)) {
sender.sendMessage("This id does not exist.");
return false;
}
if... |
3b237ced-5d37-47df-b33d-c6734dc0b2a1 | 4 | private float AssignDL(XmlNode n1, XmlNode n2)
{
if (n1 == null && n2 == null)
throw new RuntimeException("Xml node n1 and n2 could not be null");
Coordinate c1 = this.tree.getCoordinate(n1);
Coordinate c2 = this.tree.getCoordinate(n2);
if (c1 == null && c2 == null)
throw new RuntimeException("c1 a... |
2f9fe013-8862-4fe6-ab17-f62030844e96 | 2 | private void bntAbrirActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_bntAbrirActionPerformed
FileFilter tipoXml = new FileFilter() {
@Override
public boolean accept(File f) {
return f.getName().toLowerCase().endsWith(".xml") || f.isDirectory();
... |
3596f85a-58bb-45e1-bdb8-d747c2775ede | 7 | public boolean equals(Loan loan) {
return (this.material.equals(loan.getListOfMaterials())
&& (this.sameDate(startDate, loan.getStartDate()))
&& (this.sameDate(this.endDate, loan.getEndDate()))
&& (this.sameDate(this.askDate, loan.getAskDate()))
&& this.user.equals(loan.getUser())
&& (this.gaveBac... |
0aff2290-7ef5-4bf2-a4ca-90601974c549 | 1 | public List<ComBerechtigung> getAlleBerechtigung (){
List<Berechtigung> listeBerechtigung = dbZugriff.getAlleBerechtigungen();
List<ComBerechtigung> rueckgabe = new ArrayList<ComBerechtigung>();
for (Berechtigung berechtigung : listeBerechtigung){
rueckgabe.add(new ComBerechtigung(berechtigung.getIdBerechtigu... |
9fb421fe-bdcc-4887-bc9a-fb24f7719b55 | 4 | static String getSuffix(int arg) {
if (arg < 0) {
return "";
}
if (arg % 10 == 1) {
return "st";
}
if (arg % 10 == 2) {
return "nd";
}
if (arg % 10 == 3) {
return "rd";
}
return "th";
} |
e6cd9ac9-50ce-438a-8dfa-ee31d322ace9 | 5 | public final Object newInstance(Object[] args)
throws CannotCreateException
{
int n = constructors.length;
for (int i = 0; i < n; ++i) {
try {
return constructors[i].newInstance(args);
}
catch (IllegalArgumentException e) {
... |
9e6e89ec-13c3-406e-add3-ffa76fb8547d | 3 | public AttributeInfo copy(ConstPool newCp, Map classnames) {
byte[] src = get();
byte[] dest = new byte[src.length];
ConstPool cp = getConstPool();
LocalVariableAttribute attr = makeThisAttr(newCp, dest);
int n = ByteArray.readU16bit(src, 0);
ByteArray.write16bit(n, dest,... |
4cc10f48-aa92-4a24-8a3d-e4ef0725188e | 1 | public void addWay(int pos, long wayId){
if (!ways.contains(wayId))
ways.add(wayId);
} |
911a5f8b-1250-4b21-93b5-07fe5d19b0a2 | 5 | @Override
public boolean equals(Object object) {
// TODO: Warning - this method won't work in the case the id fields are not set
if (!(object instanceof Telefone)) {
return false;
}
Telefone other = (Telefone) object;
if ((this.id == null && other.id != null) || (... |
2f16f42b-adbc-4e4b-b273-80f81ce5712a | 5 | @Override
public void Parse(Session Session, EventRequest Request)
{
int Page = Request.PopInt();
int Item = Request.PopInt();
CatalogItem mItem = new CatalogItem(Item);
if (mItem.Page != Page)
{
return;
}
if (Session.GrabHabbo().Credits < mItem.Cost)
{
return;
}
if (mItem.GrabBa... |
25ec8dbd-b865-46c8-9015-b7a210f6214a | 9 | @Override
public void dataReceived(FilterEntity nextEntity, Session session,
Object data) throws Exception {
buffer = ByteUtils.merge(buffer, (byte[]) data);
// Check buffer
if (Protocol.isValid(buffer)) {
// specifier ready!
ProtoParser parser = new ProtoParser();
try {
parser.parse(buffer);
... |
ef2f2f8e-0ec1-4387-aac8-caaa21b6c265 | 0 | public OntClass getOntClass(OntModel model) {
return model.createClass(getUri());
} |
65093d27-1150-427d-8cfb-eb472945a37b | 1 | public static void main(String[] args) throws IOException {
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
int tests = Integer.parseInt(in.readLine());
while (tests > 0) {
stringSim(in.readLine());
//kmpTable(in.readLine());
/*if (kmpSearch(in.readLine(), in.readLine())) ... |
b1aca175-deb2-44a7-b821-27e96b906845 | 8 | public synchronized void gridletCancel(int gridletId, int userId) {
double currentTime = GridSim.clock();
boolean updateProfile = false;
SSGridlet sgl = runningJobs.get(gridletId, userId);
if (sgl != null) {
// Test if job has finished
if(sgl.getStatus() ==... |
c952e5f4-bc83-4154-ba9f-2240f170e02c | 7 | public static final int getMesoRate(byte village) {
switch (village) {
case 0:
return 5000;
case 1:
return 3000;
case 2:
return 5000;
case 3:
case 4:
return 3000;
case 5:
... |
36714ec8-2b30-4112-bbcd-85e8467de8f8 | 2 | public void addPhi(final Block block) {
final int blockIndex = cfg.preOrderIndex(block);
if (phis[blockIndex] == null) {
if (SSAPRE.DEBUG) {
System.out.println(" add phi for " + prototype + " at "
+ block);
}
phis[blockIndex] = new Phi(this, block);
}
} |
a6e2e49e-3011-4de1-9009-8e325dd66358 | 9 | public static void main(String[] args) {
//Conjunto de variables pero no instancias
int dificultad = 0;
int movimientos = 0;
int cantBarcos = 5;
int x = 0;
int y = 0;
boolean ganador = false;
boolean error = false;
//Intacio un nuevo tiempo
Tiempo tiempoJuego = new Tiempo();
System.out.print... |
6db5b110-1270-48eb-819a-26f44fd37252 | 9 | @Override
protected boolean checkYObstacle(CommonObject so, double time, int halfOfWidth) {
if ((this.currentCoord.getY() + this.currentHeight + currentVerticalSpeed * time >= so.getCurrentCoordinates().getY())
&& (this.currentCoord.getY() + this.currentHeight <= so.getCurrentCoordinates().g... |
b75d6537-8a64-4bd9-b2fa-4937be3b11ee | 4 | public static String[] chunk(String str, int chunkSize) {
if (isEmpty(str) || chunkSize == 0) {
return new String[0];
}
final int len = str.length();
final int arrayLen = ((len - 1) / chunkSize) + 1;
final String[] array = new String[arrayLen];
for (int i = 0... |
444feaa3-3675-4aa4-bbac-199a02ea6408 | 9 | private static void getlocation(Feed f, Document doc)
throws PachubeException {
NodeList nodeLst = doc.getElementsByTagName("location");
Node c = nodeLst.item(0);
Location l = new Location();
NamedNodeMap n;
if (c != null) {
n = c.getAttributes();
... |
c21af593-a06e-4fb2-933f-5fde80b973ac | 3 | private final boolean newer(String currentVersion, String checkVersion) {
String[] currentParts = currentVersion.split("\\.");
String[] checkParts = checkVersion.split("\\.");
for (int i = 0; i < Math.min(currentParts.length, checkParts.length); i++) {
int current = Integer.parseInt(currentParts[i]);
int c... |
3b299567-b713-4afd-92f8-6e5883292d28 | 9 | private void listUnderJarCustom(String packagePath,FileExt jarFile,Collection<JavaFileObjectInputClassInFileSystem> result)
{
String normalizedPath = jarFile.getCanonicalPath();
if (normalizedPath.contains("\\")) // Windows
{
// No estoy seguro de que sea necesario normalizar pero por si... |
eb31f241-b0fe-4789-84fa-7141ca7026cf | 2 | @Override
public void endElement(String uri, String localName, String qName) throws SAXException {
if (qName.equals("rowset") && memberCorporations)
memberCorporations = false;
super.endElement(uri, localName, qName);
} |
c56e3eda-d46b-4668-a48f-c1f4cd9f85f2 | 7 | public Usuario selectGerentePorDepartamento(String CodDepartamento, String Tipo) throws SQLException {
Connection conexao = null;
PreparedStatement comando = null;
ResultSet resultado = null;
Usuario user = null;
try {
conexao = BancoDadosUtil.getConnection();
... |
9def6f20-7af3-49c8-bc16-dadd1ed2f655 | 7 | protected void merge(int begin, int middle, int end)
{
int firstHalf, secondHalf, count;
firstHalf = count = begin;
secondHalf = middle + 1;
while (firstHalf <= middle && secondHalf <= end)
{
if (this.compareElementsAt(secondHalf, firstHalf) < 0)
{
swapSpace[count++] = toSort[secondHalf++];
}
... |
323a9fac-7e3e-4eac-8125-5b459120a08b | 4 | private void LoginActionPerformed(java.awt.event.ActionEvent evt) {
String name = userName.getText();
//String psw ;
//psw = new String(password.getPassword());
Long count = 0L;
Long count1 = 0L;
String psw = new String(password.getPassw... |
dd8bada1-58d3-480c-ab37-20701d8b3e62 | 2 | public static void clearCommentForSingleNode(Node node, CompoundUndoable undoable) {
int oldValue = node.getCommentState();
int newValue = Node.COMMENT_INHERITED;
if (oldValue != Node.COMMENT_INHERITED) {
node.setCommentState(Node.COMMENT_INHERITED);
undoable.addPrimitive(new PrimitiveUndoableCommentChan... |
bf8a35a7-4ddc-4410-85a9-00275b84e0d7 | 7 | public void draw(Render r, int xoffset, int yoffset) {
for (int y = 0; y < r.h; y++) {
int ypix = y + yoffset;
if (ypix < 0 || ypix >= Virucide.h) {
continue;
}
for (int x = 0; x < r.w; x++) {
int xpix = x + xoffset;
... |
941ae9e9-c7ca-4660-aac4-4316f71a8a39 | 5 | @Override
public void draw(Graphics g, Board board, int width, int height) {
int leftCoord = this.getCellColumn()*width;
int topCoord = this.getCellRow()*height;
g.setColor(Color.DARK_GRAY);
g.fillRect(leftCoord, topCoord, width, height);
//if cell has a door, draw a blue line to indicate direction
if(t... |
fbe3dd36-ece3-474a-8311-9abee6364e69 | 8 | private boolean r_un_accent() {
int v_3;
// (, line 215
// atleast, line 216
{
int v_1 = 1;
// atleast, line 216
replab0: while (true) {
lab1: do {
if (!(out_grouping_b(g_v, 97, 251))) {
break lab1;
}
v_1--;
continue replab0;
} while (false);
break replab0;
}
... |
e853b0db-37ac-4c26-bf81-39c74d13368f | 3 | private void copyPALtoRGBA(ByteBuffer buffer, byte[] curLine) {
if(paletteA != null) {
for(int i=1,n=curLine.length ; i<n ; i+=1) {
int idx = curLine[i] & 255;
byte r = palette[idx*3 + 0];
byte g = palette[idx*3 + 1];
byte b = palette[i... |
c9d0e3bb-638f-4357-a6b5-2f601bf02f26 | 5 | public void moveToFood() {
if (x < Tree.getTreex()) {
isRPress = true;
} else if (x > Tree.getTreex()) {
isLPress = true;
}
if (y > Tree.getTreey()) {
isUPress = true;
} else if (y < Tree.getTreey()) {
isDPress = true;
}
if (Math.sqrt(Math.pow(x - Tree.getTreex(), 2) + Math.pow(y - Tree.get... |
7ccb445f-d8a6-443f-a969-39b54b5d5ee3 | 0 | public String getFilename(int book, int chapter) {
StringBuilder sb = new StringBuilder();
return sb.toString();
} |
d1fca451-1e29-442b-8b1a-cd87d8f4d43f | 6 | public void update(){
getNextPosition();
checkTileMapCollision();
setPosition(xtemp, ytemp);
if(flinching){
long elapsed = (System.nanoTime() - flinchTimer) / 1000000;
if(elapsed > 400){
flinching = false;
}
}
if(right && dx == 0){
right = false;
left = true;
facingRight = false;... |
3b910d62-7f0d-47fd-8f66-a9d5c9b29731 | 5 | public boolean equals(Object obj) {
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
Disciplina other = (Disciplina) obj;
if (codigo == null) {
if (other.codigo != null){
return false;
} else {
return true;
}
} else if (!codigo.equals(other.codigo)){
... |
9df02e73-343d-4690-a184-13a79136a0ba | 4 | public void addRow(Object[] data)
{
if (getRowCount() > 0 && getRowCount() < 21)
{
Object[][] temp = new Object[this.data.length + 1][this.data[0].length];
for (int i = 0; i < temp.length - 1; i++)
{
temp[i] = this.data[i];
}
Object[] newData =
{ new String("-"),
new Integer(temp.length... |
e1a17cb3-9d7d-4ecf-884b-95cc349e4427 | 2 | public static void loadFromFile() throws Exception{
String filename = "Girl.bin";
File file = new File(filename);
FileInputStream fis = new FileInputStream(file);
ObjectInputStream ois = new ObjectInputStream(fis);
try{
Object temp = ois.readObject();
if(temp.getClass().getName().equals("Girl")){
he... |
b60171fb-231a-46e1-ada2-bf0d257959c3 | 4 | public String findRandom()
{
//the result with the linked list at the random position in the table
String result = "";
ListNode newNode = null;
Random random = new Random();
int position = random.nextInt(hashListSize);
int positionInList = 0;
boolean initialised = false;
//while the data is not initia... |
d891b645-d2c2-461e-90e0-0ca3b948102d | 3 | public static void addClassProgression(int i) {
// Cap levels to 20
if (classProgression.size() < 20) {
// if class not taken, and not at the 3 class limit
// add it to our unique class list
if (!classTaken(i))
addTakenClass(i);
if (classTaken(i))
classProgression.add(i);
}
} |
31e55098-a1b4-4872-b95f-02813ae22a65 | 1 | @EventHandler (priority = EventPriority.HIGHEST)
public void onFoodLevelChange(FoodLevelChangeEvent e) {
// Because e.getEntity() returns HumanEntity, we don't have to perform an instance check.
Player p = (Player) e.getEntity();
//FileConfiguration cfg = plugin.getConfig();
HungerChangeEvent event = new... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.