method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
3ffdfdb7-c910-4ba0-970b-4b5660100e98 | 3 | private Node join(Node leftTree, Node rightTree) {
if (leftTree == null)
return rightTree;
if (rightTree == null)
return leftTree;
if (bernoulli((double) leftTree.count
/ (leftTree.count + rightTree.count))) {
leftTree.right = join(leftTree.right, rightTree);
leftTree.count = 1 + size(leftTree.l... |
603513b3-f93b-4949-a6c9-034cccaa5f89 | 7 | public static List<ClanMember> getAll(String clan) throws IOException {
List<ClanMember> list = new ArrayList<ClanMember>();
HttpURLConnection http = (HttpURLConnection) new URL(clanHome + clan).openConnection();
http.setConnectTimeout(15000);
http.setReadTimeout(30000);
BufferedReader inLines = new Buff... |
8ccc2eac-eb2c-4d36-a03b-9203bb5ed53b | 7 | public String getRezepteTableau(){
String out = "";
for (int i=0; i< this.getNrRezepte(); i++ ){
Recipe recipe = this.modelData.getRecipes().getRecipe().get(i);
out += "<table border=\"1\" id=\"rezeptTable\" class=\"gridTable\" >\n";
out += "<tr class=\"gridTitleRow\" ><th colspan=\"5\">Rezepte "+(i+1)+"</... |
4011091f-e6f4-453e-ba03-1e21cfc68286 | 0 | public void setCallType(CallType callType) {
this.callType = callType;
} |
2831efec-7726-4eda-bb9c-9bbcde9411eb | 1 | public boolean login(String userID, String password) {
// TODO Auto-generated method stub
if (getFact.login(userID, password)) {
return true;
}
else
return false;
} |
c765f5f8-5dfe-47db-ac25-0c856ee2db81 | 3 | public void customMethod() {
String tmp = orgStr;
System.out.println("-----------------custom--------------");
long startDate = System.currentTimeMillis();
for (int i = 0; i < 10000; i++) {
while (true) {
String splitStr = null;
int j = tmp.indexOf(";");
if (j < 0)
break;
splitStr = tmp.... |
b8fb1560-5f58-4aad-9b49-c9ca0c8462d8 | 7 | protected void noiziseOneSeq(Vector<Event> os, Vector<Event> ns){
int noiseLen=(int)(errorRate*os.size());
if(os.size()-noiseLen<0){
System.out.println("one sequence: os.size()-noiseLen<0");
return;
}
if(noiseLen<=1){
System.out.print... |
d174499c-c591-4ac3-a54e-7678900083e8 | 0 | public int getHeight() {
return height;
} |
84078c79-2468-4db9-a775-b94135dcfdbe | 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 fe... |
b546fc25-6bbe-4f26-9645-cdd23a571822 | 4 | public void calcFreq()
{
for(int i=0; i<g.getBoard().length; i++)
{
for(int j=0; j<g.getBoard()[0].length; j++)
{
for(int k=0; k<chroms.size(); k++)
{
chroms.get(k).checkChrom(g.getBoard()[i][j]);
}
... |
70d58ea6-625e-40fa-8ec4-4d9529304403 | 9 | private static int[] getVector() {
boolean numberBegin = false;
boolean addDigit = false;
boolean isDigit;
int numberBeginPos = -1;
int[] vector;
int position = 0;
char eachChar;
String vector1;
String temporary = "";
Scanner input;
... |
1daf8bb1-22c8-43fc-b2ac-aabcb2d84a2c | 3 | private void dispatcher(Object message) throws UnknownHostException, IOException{
if(message instanceof ReservationRequestMessage){
ReservationRequestMessage request = (ReservationRequestMessage) message;
int seat = request.getSeatReservation();
int line = seat/40;
int column = seat%... |
1d7a197d-e66f-41c7-a020-b035bcc7c877 | 4 | public void mouseClicked(MouseEvent e) {
if(e.getX()>380&&e.getY()>100&&e.getX()<380+120&&e.getY()<100+40){
//Start.start();
target=new Target((WIDTH/2-GameBoard.BOARD_WIDTH/2)+Tile.WIDTH,(HEIGHT-GameBoard.BOARD_HEIGHT-100)-200);
board=new GameBoard((WIDTH/2-GameBoard.BOARD_WIDTH/2),HEIGHT-GameBoard.BOARD_HEI... |
c790bddc-aea2-48d9-9547-5fbf341b2175 | 5 | public SegmentedImage[] track(String folderName, String headerName){
//perform tracking
final File folder = new File(folderName);
File[] folderFiles = folder.listFiles();
FileWrapper[] files = new FileWrapper[folderFiles.length];
SegmentedImage[] segmented = new SegmentedImage[folderFiles.length];
System.ou... |
593d6933-71ac-4d23-b26e-ea643dfda311 | 4 | public String getLabelText(int pos) {
if (pos < 1)
pos = 1;
int labelPos = 1;
for (Widget i = wdg().child; i != null; i = i.next) {
if (i instanceof Label) {
if (labelPos == pos) {
Label l = (Label) i;
return l.text.text;
}// pos==
else {
labelPos++;
continue;
}// else
... |
14151ea0-0c06-4cc7-8eb8-24ee896d694f | 1 | public void addInformations(String[] code)
{
for (int i = 0; i < code.length; i++)
addInformation(code[i]);
updateSize();
notifyZElement();
} |
6150a816-65ea-4d1f-9c73-12bee5655876 | 8 | protected int countNeighbours(int col, int row) {
int total = 0;
total = getCell(col-1, row-1) ? total + 1 : total;
total = getCell( col , row-1) ? total + 1 : total;
total = getCell(col+1, row-1) ? total + 1 : total;
total = getCell(col-1, row ) ? total + 1 : total;
total = getCell(col+1, row ) ? total +... |
4c2ded0f-bdaf-4baa-8609-2155ea1357dc | 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 Skills)) {
return false;
}
Skills other = (Skills) object;
if ((this.skillsid == null && other.skillsid != null... |
e391df2c-ed83-4221-b4eb-afaae60c13d3 | 0 | public void illusion()
{
} |
9bef7f3c-4c53-4222-8250-b9a60415921f | 5 | private static <L> State resolvePair(StatePair lr, Fst<L> left,
Fst<L> rigth, final Map<StatePair, State> chart, Fst<L> intersection) {
if (chart.containsKey(lr)) {
return chart.get(lr);
} else {
boolean isInit = left.isInitial(lr.fst) && rigth.isInitial(lr.snd);
boolean isAccept = left.isAccept(lr.fst)... |
1871ef0d-037b-4355-8c1f-2608956f63c4 | 8 | MethodsStringConverter(Class<T> cls, Method toString, Method fromString, Class<?> effectiveType) {
super(cls, toString);
if (Modifier.isStatic(fromString.getModifiers()) == false) {
throw new IllegalStateException("FromString method must be static: " + fromString);
}
if (from... |
e19a29e0-cc8a-44ca-82fd-9d528b3b5bb1 | 9 | private static boolean validateRegion(Region r, Method subCmd){
int maxHeight = -1,
maxLength = -1,
maxWidth = -1,
minHeight = 1,
minWidth = 5,
minLength = 5;
if(subCmd.isAnnotationPresent(SizeValidation.class... |
a89ab84c-f25c-4374-9e80-74bef802c7c2 | 1 | private static boolean validVariable(String s) {
return (s.charAt(0) == '<') && (s.charAt(s.length() - 1) == '>');
} |
12df6eea-89e2-45df-ba0c-007f8c9f34e8 | 5 | public void takeDamage(float damage) {
if (basis.destroyed()) return ;
if (damage < 0) I.complain("NEGATIVE DAMAGE!") ;
adjustRepair(0 - damage) ;
final float burnChance = damage * (1 - repairLevel()) / maxIntegrity() ;
if (flammable() && Rand.num() < burnChance) burning = true ;
if (integrity <... |
b7454c63-c288-4a39-9f16-1afb09cbb1db | 9 | private void jButton_AddAccountActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton_AddAccountActionPerformed
String nymID = "ALL";
String assetID = "ALL";
String serverID = "ALL";
if (nymMap != null && nymMap.size() > 0 && jComboBox_Nyms.getSelectedIndex() > 0) {... |
0b5a5139-1fc9-41cd-8898-b6cf6ebf9186 | 2 | public void exchange (pgrid.service.corba.CorbaRoutingTable routingTable)
{
org.omg.CORBA.portable.InputStream $in = null;
try {
org.omg.CORBA.portable.OutputStream $out = _request ("exchange", true);
pgrid.service.corba.CorbaRoutingTableHelper.write ($out, rout... |
3adc797c-3f6d-417e-b27e-8e33f62c3ed7 | 8 | public static void main(String[] args) throws IOException {
Scanner scanner = new Scanner(System.in);
Hotel hotel = new Hotel(4);
boolean einde = false;
int invoer;
do {
System.out.println("Menu: [1] Status Overzicht");
System.out.println(" [2] Check-in");
System.out.println(" [3] Check-o... |
493568f8-bb06-40e0-b0a4-3cbc04180630 | 4 | public static void main(String[] args) {
Map<String, ArrayList<Integer>> map = new LinkedHashMap<String, ArrayList<Integer>>();
List<String> words = new LinkedList<String>();
words.addAll(new TextFile(
"holding_your_objects/ex16/SetOperations.jav", "\\W+"));
System.out.pr... |
57502912-7ea9-49c7-96eb-597981b3bce5 | 4 | int getB(String s1, String s2) {
int b = 0;
for (int i = 0; i < 4; i++) {
for (int j = 0; j < 4; j++) {
if (i == j) { // this situation has handled by getA.
continue;
}
if (s1.charAt(i) == s2.charAt(j)) { // if their digit m... |
5b0b789b-60aa-401e-9ef0-2095ae8f2dce | 2 | public void go() {
JFrame frame = new JFrame();
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
//InnerDrawPanel panel = new InnerDrawPanel();
MyDrawPanel panel = new MyDrawPanel();
frame.getContentPane().add(panel);
frame.setSize(300, 300);
frame.setVisible(true);
for (int i = 0; i < ... |
9168512e-ed28-47e6-bd1b-3af6dc0ff8fd | 3 | public void restartAt(int imPosn)
/*
* Start showing the images again, starting with image number imPosn. This
* requires a resetting of the animation time as well.
*/
{
if (numImages != 0) {
if ((imPosn < 0) || (imPosn > numImages - 1)) {
System.out.println("Out of range restart, starting at 0");
... |
4992c5b8-f3e9-46e3-af98-386fcc37a310 | 9 | private void iniciar() {
fachada.criarJogo();
validadorJogarParar = fachada.gerarValidadorJogarParar();
validadorSimNao = fachada.gerarValidadorSimNao();
gerenciadorRecorde = new GerenciadorRecordeImpl();
boolean continuar = true;
while (continuar) {
imprimirPlacares();
String opcao = imprimirOpcoe... |
9fc08ebc-d124-49fb-9930-b6ce8ee417e1 | 3 | private void writeInterface() {
write( "public interface " + daoName + " { \n\n" );
write( TAB + "public int create( " + table.getDomName() );
write( " value ) throws DaoException;\n\n" );
write( TAB + "public int update( " + table.getDomName() );
write( " value ) throws DaoExcep... |
6ac00bfd-8db7-4d1e-8403-738a947fca6b | 4 | private int partIt(int[] a,int left, int right, int pivot){
int leftPtr = left;
int rightPtr = right - 1;
while(true){
while(a[++leftPtr] < pivot);
while(a[--rightPtr] > pivot);
if(leftPtr >= rightPtr)
break;
else
swap(a, leftPtr, rightPtr);
}
swap(a... |
01455a51-9c60-431c-80fc-d441cc4447da | 7 | public int strToInt(String s) {
boolean minus = false;
char[] chars = s.toCharArray();
if (chars[0] == '-') {
chars = ArrayUtils.subArray(chars, 1);
minus = true;
}
else if (chars[0] == '+') {
chars = ArrayUtils.subArray(chars, 1);
}
long result = ... |
7c11055a-a15d-49fa-af07-45f951378283 | 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 City)) {
return false;
}
City other = (City) object;
if ((this.cityID == null && other.cityID != null) || (this... |
4662d6cf-fe44-4bb2-a8a3-2659c6731d2f | 0 | @Override
public void setQuestAnswer(ArrayList<String> answ) {
} |
77e110df-5d40-40ac-aeb5-189c261e7ab3 | 6 | void addLine(String line) {
if (curr > 0 || line != null) {
if (line == null) {
line = "";
}
if (curr >= height && height != -1) {
if (!line.isEmpty()) {
write("\f" + line);
curr = 0;
}
... |
06754ddb-93a1-4f82-860f-79ba1b5a0a15 | 1 | @Override
public void setX(double x){
for (KentallaOlija osa : osat){
osa.setX(x);
}
} |
5901441d-0b29-4acd-b86a-8c968db91a02 | 2 | public static String[] removeEmptyStrings(String[] data) {
ArrayList<String> result = new ArrayList<String>();
for (int k = 0; k < data.length; k++)
if (!data[k].equals(""))
result.add(data[k]);
String[] res = new String[result.size()];
result.toArray(res);
... |
7437f1c5-9354-4886-b93a-c7c4996cfeb7 | 8 | public boolean isPalindrome(String s) {
//if null, false
if (s == null) {
return false;
}
//if empty, ture
if (s.length() == 0) {
return true;
}
//make all in lower string in order to compare
s = s.toLowerCase();
int left =... |
b03b743e-280c-49a6-9092-6759781c14cd | 9 | public static int jauStarpv(double ra, double dec,
double pmr, double pmd, double px, double rv,
double pv[][])
{
/* Smallest allowed parallax */
final double PXMIN = 1e-7;
/* Largest allowed speed (fraction of c) */
final double VMAX = 0.5;
/* Maximum... |
b8835d8e-9833-49f3-a1cd-fcb6cde121cc | 3 | public static int getMinimapTextureColor(int texture) {
if (Rasterizer.averageTextureColors[texture] != 0) {
return Rasterizer.averageTextureColors[texture];
}
int red = 0;
int green = 0;
int blue = 0;
int count = Rasterizer.texturePixels[texture].length;
for (int i = 0; i < count; i++) {
red += Ras... |
91c47f5b-874d-4318-8239-077914ebb526 | 4 | public void doGet(HttpServletRequest request, HttpServletResponse response) {
try {
long id = Long.parseLong(request.getParameter("id"));
PublishedSwarmDetails swarmDetails = CommunityDAO.get().getSwarmDetails(id);
if( System.getProperty(EmbeddedServer.Setting.DONT_DISPLAY_PREVIEWS.getKey())
.eq... |
253e3278-2cb1-4ab2-94ae-9c32d6686c58 | 1 | public void requestUpdate(){
for(ModelChangeListener mcl : listeners){
mcl.changedStatus(serv_enabled,client_connected);
mcl.changedClientIP(client_ip);
mcl.changedServerIP(server_ip);
mcl.changedQLFiles(quick_launch_files);
mcl.changedServerName(serv_name);
mcl.changedServerPswd(psw_enable);
... |
5c8c86c9-0005-4168-ba8c-bd2b06f7ef3f | 2 | public int read(CharBuffer cb) {
if (count-- == 0)
return -1; // Indicates end of input
cb.append(capitals[rand.nextInt(capitals.length)]);
for (int i = 0; i < 4; i++) {
cb.append(vowels[rand.nextInt(vowels.length)]);
cb.append(lowers[rand.nextInt(lowers.length)]);
}
cb.append(" ");
return 10; // N... |
51727e5f-6752-4577-a446-408d5c754b58 | 3 | protected void Update(double timeDelta)
{
super.Update(timeDelta);
if (IsKeyTriggered(KeyEvent.VK_F1))
ToggleDebugMode();
for (PhysicsObject obj : m_physicsOnlyObjects)
obj.Update(timeDelta);
for (GameObject obj : m_objects)
obj.Update(timeDelta);
} |
7bd8582e-58ba-47a9-80d9-301c69f0abe8 | 4 | public void zoneEventOccurred(String eventZone, int eventType) {
if((eventType == ZoneEvents.MOVEMENT || eventType == ZoneEvents.ENTER )
&& eventZone.equals("normalMouse")){
Gui.changeCursor(Cursor.DEFAULT_CURSOR);
}
if(Debug.gui)
System.out.println("MOUSE EVENT "+eventType);
} |
b81df51a-3c37-493c-82f2-c180b2145195 | 4 | private void sort_cmp_time() {
cmp_num = 0;
Iterator<String> iter = cmp_timemap.keySet().iterator();
while(iter.hasNext()) {
String ss = iter.next();
cmp_timekey[cmp_num] = ss;
cmp_num++;
}
//冒泡
for(int i=0; i<cmp_num-1; i++)
{
for(int j=0; ... |
381ffbc9-eff3-4af0-a234-95cef37b95b3 | 3 | public static void main (String [] args){
Logger logger = Logger.getLogger("Main");
//if args < 0, no string was introduced so program finishes.
if (args.length > 0){
logger.info("Making query request...");
JSONReader jr = new JSONReader (APIURL + args[0]);
String content = jr.read();
... |
45a3b143-3f73-4b3a-b15d-d228ac4c50e4 | 7 | public DeleteList(Brain brain, int cbb) {
b = brain;
comboBoxIndex = cbb;
setBounds(100, 100, 450, 300);
//getContentPane().setLayout(new BorderLayout(0, 0));
getContentPane().setLayout(null);
contentPanel.setBorder(new EmptyBorder(5, 5, 5, 5));
getContentPane().add(contentPanel);
contentPanel.setLay... |
47c35a0a-080e-4eee-a30e-18a771c2ffaf | 2 | public void SetQuery(String Query)
{
if (ClassQuery != null)
{
try
{
Statement = this.Connection.createStatement();
}
catch(SQLException Ex)
{
Grizzly.WriteOut(Ex.getMessage());
}
}
ClassQuery = Query;
} |
5f40764b-6891-4648-83fb-78f22a34d253 | 1 | public static void init() {
int customerIndex = 0;
for (int bal=-1000; bal <= 1000; bal+=50) {
BankAccount newAccount =
new BankAccount(customerIds[customerIndex], BigInteger.valueOf(bal), BigInteger.valueOf(-2000));
customerIndex = (customerIndex+1)%customerIds.l... |
a7606f02-7852-4ef2-9b75-72d0de83f1ca | 0 | public Praticien() {
} |
e9cbf773-ca91-441d-9c05-34eaefb3f062 | 4 | @Override
public void run() {
String nMsg = "";
try {
HttpURLConnection urlConnection = (HttpURLConnection) pageURL.openConnection();
InputStream in = new BufferedInputStream(urlConnection.getInputStream());
Reader r = new InputStreamReader(in);
int c;
String all = "";
while ((c = r.read())... |
38c7ff62-a925-4b17-be91-efa347dfe89f | 2 | public void waitForNextFrame() {
long waitTime = frameTime - (System.currentTimeMillis() - lastTime);
if (waitTime > 0) {
try {
Thread.sleep(waitTime);
} catch (InterruptedException ex) {
Logger.getLogger(GameTimer.class.getName()).log(Level.SEVERE... |
b623b4ef-7d5d-4961-8dd8-366d9f6dff4d | 2 | public void readFileIntoMemory(String fileName) throws IOException {
File file = new File(fileName);
BufferedReader br = new BufferedReader(new FileReader(file));
String line = br.readLine();
int curVertex = 0;
int neighborVertex = 0;
int edgeToNeighbor = 1;
while (line != null) {
String[] vertexRow =... |
160a953c-d0e8-4b51-95d1-090503f5a82d | 2 | public ArrayList<ProfesorBean> getPage(int intRegsPerPag, int intPage, ArrayList<FilterBean> alFilter, HashMap<String, String> hmOrder) throws Exception {
ArrayList<Integer> arrId;
ArrayList<ProfesorBean> arrAlumno = new ArrayList<>();
try {
oMysql.conexion(enumTipoConexion);
... |
13aa21c7-13cd-4f25-9f55-7eff7665152d | 5 | public boolean containsAnyASection(int min, int max) {
Set<ASection> s = aDataMap.keySet();
Iterator<ASection> it = s.iterator ();
boolean found = false;
while(it.hasNext()){
ASection sect = it.next();
if ((sect.getStartOffset()> min &&
sect.getStartOffset()<= max) ||
(sect.getEndOffset()> min &&
... |
638fe884-518e-4bb4-aada-736e8c332201 | 3 | public static double erf(double x) {
double erf = 0.0D;
if (x != 0.0) {
if (x == 1.0D / 0.0D) {
erf = 1.0D;
} else {
if (x >= 0) {
erf = Stat.incompleteGamma(0.5, x * x);
} else {
erf = -Stat.incompleteGamma(0.5, x * x);
}
}
}
return erf;
} |
f286a448-a88c-480d-8bdc-42b10dc45b6e | 7 | private void tradeMatcher() {
Thread thread = new Thread(new Runnable() {
@Override
public void run() {
long begin = System.currentTimeMillis();
//TODO: It should not be stopped.
while ((System.currentTimeMillis() - begin) < 1000){
... |
bb7ecd41-9cea-479a-a552-55b297b57aa2 | 7 | public static ShortImageBuffer norm(ShortImageBuffer input)
{
ShortImageBuffer after = input.copyShape();
// calculate min and max
int min = 0xFFFF;
int max = 0;
for(int y=0;y<input.getHeight();y++)
{
for(int x=0;x<input.getWidth();x++)
{
... |
85d33272-31a0-4c43-a34e-d6242f5bc31a | 1 | public static void asm_movf(Integer befehl, Prozessor cpu) {
Integer w = cpu.getW();
Integer f = getOpcodeFromToBit(befehl, 0, 6);
Integer result = cpu.getSpeicherzellenWert(f);
if(getOpcodeFromToBit(befehl, 7, 7) == 1) {
cpu.setSpeicherzellenWert(f, result, true);
}
else {
cpu.setW(result, true);
... |
a8daeff2-bf2a-48f5-9e53-710819bc10c5 | 6 | public void snpEffect(String vcfFile, String txtFile, String aaHgsv, String genotype) {
// Create command
String argsVcf[] = { "-classic", "-cancer", "-hgvs", "testHg3766Chr1", vcfFile };
String argsTxt[] = { "-classic", "-cancer", "-cancerSamples", txtFile, "-hgvs", "testHg3766Chr1", vcfFile };
String args[] =... |
9d6d1859-258e-482e-a65f-e9f7d724ff84 | 2 | public static void addAction(Action newAction) {
newAction.setId(curActionId++);
boolean offerSuccessful = actionsBuffer.offer(newAction);
if(offerSuccessful && offeredListener != null) {
offeredListener.actionOffered();
}
} |
771cf6dc-c39c-497b-a2f3-71f275ca3ce2 | 4 | private void readFile(File diffMapperFile) {
try {
BufferedReader reader = new BufferedReader(new FileReader(diffMapperFile));
String[] title = reader.readLine().split("\t");
String line;
while((line = reader.readLine()) != null) {
String[] value = line.split("\t");
for(int i = 0; i < title.le... |
47976d58-b671-4d72-b68b-02ea1ffa9e43 | 9 | @Test
public static void printMarshalMethods()
throws NoSuchFieldException, IllegalAccessException {
final Field field =
Marshallers.class.getDeclaredField("MARSHAL_METHODS");
field.setAccessible(true);
@SuppressWarnings("unchecked")
final Map<?, ?> value = (Map<... |
52326c05-9535-49c4-9e3e-4bf7f7d3d554 | 7 | private boolean evaluatePlotClause(String str) {
if (!model.hasEmbeddedMovie()) {
out(ScriptEvent.FAILED, "No data is recorded or model not in recording mode.");
return false;
}
byte averageFlag = 0;
if (str.toLowerCase().startsWith("-ra")) {
str = str.substring(3).trim();
averageFlag = 1;
} else ... |
7128a19b-fe3f-4dfd-8bab-34978a0396d7 | 6 | private static int convertTimeRemaining(String time){
int seconds = 0;
String[] substrings = time.split(" ");
if (substrings[1].equals("hours") || substrings[1].equals("hour")){
seconds = Integer.parseInt(substrings[0]) * 3600;
}
if (substrings[1].equals("minutes") ||... |
a0847b0a-fc84-44ea-8d86-5361c6b07221 | 2 | public boolean checkUserId(int uid) {
for(int i=1;i<=3;i++)
if( this.user_id== uid)
{
return true;
}
return false;
} |
e9488b89-53ba-4414-91c2-c6780ecf476f | 8 | @SuppressWarnings("unchecked")
public ActionForward addToMyCart(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response)
throws Exception {
int productseq = Integer.parseInt(request.getParameter("productseq"));
String productname = new String(request.getParameter("pro... |
53fa7cfd-1a19-485f-b987-dd78cd8fd044 | 6 | public static void main(String[] args) {
List<OfficeSpace> reserved = new ArrayList<OfficeSpace>();
String token = "abcd1234";
try {
// Load initial Provider and Officespace
ProviderLoad.initialLoad("./sampleData/Provider1data.txt");
ProviderLoad.initialLoad("./sampleData/Provider2data.txt");
... |
565409de-c0f7-4345-9664-d98e03628f85 | 5 | private synchronized void parserNode(Node node, WebPage srb) throws Exception {
if (node instanceof TextNode) {// 判斷是否是文本結點
srb.addText(((TextNode) node).getText());
} else if (node instanceof Tag) {// 判斷是否是標籤庫結點
Tag atag = (Tag) node;
if (atag instanceof TitleTag) {// 判斷是否是標TITLE結點
srb.setTitle(atag.g... |
7fefc29e-431a-4dd8-ab3d-621e4523efbc | 0 | @Override
public void mouseReleased(MouseEvent e) {
isMouseDown = false;
} |
cf9a5ddb-7458-474a-ae26-e251d1c95e44 | 4 | public void test(int down, int left, int right) {
if (down == fill) {
sum++;
addToResult();
return;
}
int canNot = down | left | right;
if (canNot == fill)
return;
for (int i = 0; i < n; i++) {
int put = 1 << i;
... |
db77bea5-7edd-4123-bd43-7f14354039a8 | 1 | @RequestMapping(value = "/student/{studentId}/enrolldegree", method = RequestMethod.POST)
public String enrollDegree(ModelMap model,
@PathVariable("studentId") int studentId,
@RequestParam("degreeid") int degreeId) {
logger.debug("Enrolling student " + studentId + " in degree "
+ degreeId);
if (studentS... |
6fbb141c-72f8-463c-880a-1cb6a4451ab3 | 7 | public static int getAge2(
int age0,
Random aRandom) {
if (age0 < 20) {
return aRandom.nextInt(20);
}
if (age0 < 30) {
return (20 + aRandom.nextInt(10));
}
if (age0 < 40) {
return (30 + aRandom.nextInt(10));
}
... |
ac830ac2-c172-4838-ab17-2ad04e85c514 | 3 | public boolean sees(Entity other) {
if (distanceSquared(other) > visualRangeSquared)
return false; // only check in circle with r=200
double p1X = this.xPos - other.xPos;
double p1Y = this.yPos - other.yPos;
double p2X = this.xPos - other.xPos + Math.cos(Math.toRadians(heading))
* 10;
double p2Y = thi... |
d242b27e-4c15-4e0a-b41a-e0115ffbfcbf | 2 | public static Date stoDate(String str){
Date i = null;
if(str!=null){
try{
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
i = format.parse(str);
new Date();
}catch(Exception e){
i = null;
}
}else{
i = null;
}
return i;
} |
86c6a377-3573-49bb-bb58-ccefce5f4b9f | 0 | public void testPeriodic() {
// Updates sensors & actuators on the LiveWindow
LiveWindow.run();
} |
c989a5c3-709c-4c24-93c1-bc90f00b7a56 | 4 | public void keyReleased(KeyEvent e){
int key = e.getKeyCode();
if (key == KeyEvent.VK_LEFT) {
dx = 0;
}
if (key == KeyEvent.VK_RIGHT) {
dx = 0;
}
if (key == KeyEvent.VK_UP) {
dy = 0;
}
if (key == KeyEvent.VK_... |
9d470b93-fd78-4e97-8335-1bf94754c78f | 6 | private static CommandLine getCommandLine(String args[])
{
HelpFormatter formatter = new HelpFormatter();
Options options = getOptions(args);
CommandLineParser parser = new PosixParser();
CommandLine cmd = null;
try
{
cmd = parser.parse(options, args);
}
catch (ParseException e)
{
System.err.pr... |
8dc498b7-ecc0-4c6f-bbce-c66d798c9e4e | 8 | public void addButtons() {
GridBagConstraints c = new GridBagConstraints();
c.fill = GridBagConstraints.BOTH;
c.weightx = 1;
c.weighty = 1;
c.insets = new Insets(2, 2, 2, 2);
int item = 0;
for (int i=0;i<5; i++) {
for (int j=0;j<5; j++) {
if (buttons[item].equals("0")) {
JButton btn;
if (... |
0b74739a-7336-4a78-91e4-14a31e471024 | 9 | public String toString() {
StringBuffer sb = new StringBuffer();
sb.append('[');
for (int i = 0; i < pop.fieldCount(); i++) {
if (pop.fieldCount() > 1)
sb.append(" f"+i+":");
PopField f = pop.getField(i);
if (!f.tour) {
int size = f.stringSize;
if (size > 50)
... |
0ebed221-09fe-4b94-a7c2-8604856e2d06 | 7 | public void setfocus(Widget w) {
if (focusctl) {
if (w != focused) {
Widget last = focused;
focused = w;
if (last != null)
last.hasfocus = false;
w.hasfocus = true;
if (last != null)
... |
2e66992b-5246-423a-b9c1-4c7944d06ab8 | 5 | public Object [][] getDatos(){
Object[][] data = new String[getCantidad_Cuentas ()][colum_names.length];
//realizamos la consulta sql y llenamos los datos en "Object"
try{
if (colum_names.length>=0){
r_con.Connection();
String c... |
865e1e5b-2093-4c88-afdc-5749a48c7c40 | 5 | @SuppressWarnings("unused")
private static void AlphabeticalOrder(){
Scanner keyboard = new Scanner(System.in);
System.out.print("What is your name? ");
String input = keyboard.next();
if (input.compareTo("Carswell") <= 0)
System.out.println("you don't have to wait long");
else if (input.compareTo("... |
9cb49c23-f881-431b-a45d-82fc5c5c4fdc | 3 | @Override
public void run() {
File plik = new File( path );
while( true ) {
if( plik.canRead() ) {
flaga = true;
} else flaga = false;
try {
sleep( odstep );
} catch ( InterruptedException e ) {
ret... |
9883434d-4104-4589-92aa-e41946541eae | 9 | @Override
public void atribuirJogo(String cod_jogo, String cod_equipa) {
String[] aux = cod_jogo.split("_");
int jogo = Integer.parseInt(aux[2]);
System.out.println(this.getDAOJornada().size(this.getCod_competicao()));
if ((this.getDAOJornada().size(this.getCod_competicao())-1)==(Int... |
581b336d-617f-42c9-8d3a-79c35686f2eb | 8 | public void generate(JFormatter f) {
// generally we produce new T[x], but when T is an array type (T=T'[])
// then new T'[][x] is wrong. It has to be new T'[x][].
int arrayCount = 0;
JType t = type;
while( t.isArray() ) {
t = t.elementType();
... |
3d1b471e-cf4e-4ca7-8a23-74ee98c08b9c | 7 | public static double[] matrixMinAndMax(List<double[]> dataSet, int index, int axis){
double[] ret = new double[2];
ret[0] = Double.MAX_VALUE;
ret[1] = Double.MIN_VALUE;
int m = dataSet.size();
int n = dataSet.get(0).length;
if(axis == 0){
for(int i=0;i<m;i++){
double val = dataSet.get(i)[index];
... |
17d1e231-2328-45c7-8b23-2b408970f006 | 7 | public boolean setInputFormat(Instances instanceInfo) throws Exception {
if ((instanceInfo.classIndex() > 0) && (!getFillWithMissing())) {
throw new IllegalArgumentException("TimeSeriesDelta: Need to fill in missing values " +
"using appropriate option when class inde... |
1013260c-8ce2-4550-8486-f310ae273f12 | 9 | public Sound() {
Debug.println("Sound.Sound()");
muted = false;
fxQueue = new LinkedList<Integer>();
AudioInputStream as = null;
try {
as = AudioSystem.getAudioInputStream(ROLL_SOUND);
} catch (UnsupportedAudioFileException e) {
e.printStackTrace();
return;
... |
0cc1da2c-46c1-4b01-ab3c-547fe0840f25 | 8 | @SuppressWarnings("unchecked")
private StackInterface<Method> instantiate(SimulationComponent mComp) {
String problem = "";
try {
Constructor<?> m = Class.forName("CallStack").getConstructor(SimulationComponent.class);
System.err.println("Call Stack instantiated... will attempt to run on VM!");
... |
4933600d-6cd9-4152-9117-e7e23e3ab2fb | 7 | public static void setPlatform(int plaf)
{
if (plaf < WINDOWS_XP || plaf > GNOME)
throw new IllegalArgumentException("Unknown platform: " + plaf);
CUR_PLAF = plaf;
switch (plaf) {
case WINDOWS_XP:
setRelatedGap(LPX4, LPY4);
setUnrelatedGap(LPX7, LPY9);
setParagraphGap(LPX14, LPY14);
setInd... |
ad302754-acc5-4299-945d-21c5a39c7b19 | 5 | public void updateAccountPassword(String user, String password) {
PreparedStatement statement = null;
try {
statement = conn.prepareStatement("update Accounts set Password=? where Username=?");
MessageDigest digest = MessageDigest.getInstance("SHA-256");
byte[] hash = digest.digest(password.getBytes("UTF-8... |
ba2376de-6daa-4200-9f1c-bc3a602728ae | 8 | public String toString() {
StringBuffer sb = new StringBuffer();
sb.append(negative ? "N" : "n");
sb.append(overflow ? "V" : "v");
sb.append(memory_access ? "M" : "m");
sb.append(index_register ? "X" : "x");
sb.append(decimal_mode ? "D" : "d");
sb.append(irq_disable ? "I" : "i");
sb.append(z... |
5e7590b2-5d35-42eb-99ea-e95274fc4528 | 2 | protected Transition createTransition(State from, State to, Node node, Map e2t, boolean isBlock)
{
/*
* The boolean isBlock seems to be ignored in FSATransducer.java, so I'm ignoring
* it here too.
*/
String label = (String) e2t.get(TRANSITION_READ_NAME);
String o... |
f339b0a3-56c0-45a9-94ff-8698121f5b3e | 3 | private static HashSet<Person> getNeighbors(Person p) {
HashSet<Person> neighbors = new HashSet<Person>();
for (Person[] edge : hardConnections) {
if (edge[0].equals(p))
neighbors.add(edge[1]);
else if (edge[1].equals(p))
neighbors.add(edge[0]);
}
return neighbors;
} |
4afd9b41-3f73-4388-a808-7586cadb820a | 7 | private OSMNodeData getNodeInformation(Attributes attributes) {
String idStr = attributes.getValue("id");
String latStr = attributes.getValue("lat");
String lonStr = attributes.getValue("lon");
// Avoid null pointer reference!
if (idStr != null && latStr != null && lonStr != null... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.