method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
c79a3983-c032-46d5-85c7-c8cede790244 | 0 | public void put(Object o)
{
queueList.addLast(o);
} |
35e1910a-3ee5-4ef1-9ffa-1f58d46984a6 | 6 | public final Section build() {
final Section SECTION = new Section();
for (String key : properties.keySet()) {
if ("start".equals(key)) {
SECTION.setStart(((DoubleProperty) properties.get(key)).get());
} else if("stop".equals(key)) {
SECTION.setSto... |
2e7d76fe-992c-4b2b-8cea-eb7490603d27 | 7 | public void run() {
while (active) {
int mod = timeElapsed % 7;
switch(mod)
{
case 0:
log.info("info level log.");
break;
case 1:
log.debug("debug level log.");
break;
case 2:
log.error("error level log");
break;
case 3:
log.warn("warn level log");
break;
case 5... |
5801689a-e5ba-411a-91ed-64b0489f8166 | 6 | public static void main(String[] args) {
// TODO Auto-generated method stub
Scanner scanner = new Scanner(System.in);
int m=scanner.nextInt();//灯的数目
int array[]=new int[m+1];
for(int i=0;i<m+1;i++){
array[i]=0;
}
for(int i=1;i<m+1;i++){
int flag=i;
int flag1=flag;
while(flag1 < m+1){... |
eaf45596-abb6-4ef8-9c09-87997fa59f96 | 3 | public int tsfLookback( int optInTimePeriod )
{
if( (int)optInTimePeriod == ( Integer.MIN_VALUE ) )
optInTimePeriod = 14;
else if( ((int)optInTimePeriod < 2) || ((int)optInTimePeriod > 100000) )
return -1;
return optInTimePeriod-1;
} |
ac0c7986-dbe2-4dc7-9163-b23b2405cfb0 | 3 | public void checkCbolOriginalDirV2() {
Path dir = Paths.get(CBOL_HOME);
//
//http://docs.oracle.com/javase/tutorial/essential/io/dirs.html
String str;
String str2;
String str3;
try (DirectoryStream<Path> stream = Files.newDirectoryStream(dir)) {
for (... |
1f5cb140-a08b-4639-916e-1d92f8576cc6 | 4 | public boolean removeHotkeyBinding(String key) {
if (!this.fileLoaded) {
return false;
}
try {
XMLNode hotkeysNode = this.rootNode.getChildNodesByType("hotkeys")[0];
XMLNode[] hotkeys = hotkeysNode.getChildNodesByType("hotkey");
for (XMLNode node... |
72051a71-2a25-4037-9242-0df24fb2a6c1 | 6 | public Report getReportById(int report_id) {
Report r = new Report();
ResultSet rs = null;
try {
statement = connection.createStatement();
String sql = "select * from reports where id = " + report_id;
rs = statement.executeQuery(sql);
if(rs.next()) {
r.setCabin_id(rs.getInt("cabin_id"));
r.se... |
27ff07a5-b7cf-4bca-841e-4d1ac82b63f7 | 7 | private GsSong[] readFile(File f) {
if(!f.exists())
return null;
try {
int size=0;
GsSong[] res=new GsSong[1];
res[0]=null;
BufferedReader in=new BufferedReader(new FileReader(f));
String line;
while((line=in.readLine())!=null) {
if(line.length()==0) // skip empty lines
continue;
i... |
74619510-e0aa-4088-bb50-6ed1c8866dcb | 7 | private void downloadSW(String url) {
String fileSizeString = "";
long fileSize = 1;
_percent = 0;
try {
_builder = new ProcessBuilder(_downloadcmd, "-c", "--progress=bar",
url);
_builder = _builder.redirectErrorStream(true);
_process = _builder.start();
InputStream stdout = _process.getInputS... |
2f4cd5e7-b1a8-4ef6-90c1-334dc7c1784f | 7 | public static ReservedWords parseCommand(String command) {
if (command.equalsIgnoreCase("add"))
return ReservedWords.ADD;
if (command.equalsIgnoreCase("create"))
return ReservedWords.CREATE;
if (command.equalsIgnoreCase("remove"))
return ReservedWords.REMOVE;
... |
9c09c3a8-79b9-47c6-b7d6-bbb880aafe87 | 1 | public float getRZAxisDeadZone() {
if (rzaxis == -1) {
return 0;
}
return getDeadZone(rzaxis);
} |
2a9c5109-1db5-44ab-8404-6f4fa3cb8182 | 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... |
b94ab218-7273-40ca-ace5-ba0ee07d1e82 | 0 | public SaveGraphJPGAction(Environment environment, JMenu menu) {
super("Save Graph as JPG", null);
this.environment = environment;
this.myMenu = menu;
} |
5cbd0674-6548-4da7-9277-331f7039fb1b | 9 | @Override
public void paintBorder(final Component c, Graphics g, int x, int y, int width, int height) {
Color saveColor = g.getColor();
try {
final Rectangle r = c.getBounds();
if (options.top > 0) {
int colorIndex = startIndex;
for (int i = r.x; i < (r.x + r.width); i += options.top) {
g.setC... |
8f172b17-c0bd-4039-934d-76b33bc26840 | 9 | public void updatePositions(){
dyingParticles.clear();
for(Particle p: aliveParticles){
if( checkCollision( p.getxPosition(), p.getyPosition() ) == true ){
for( int newx = (p.getxPosition() - 2) ; newx <= (p.getxPosition() + 2) ; newx++){
for( int newy = (p.getyPosition() - 2) ; newy <= (... |
69de5110-e438-474a-9bbd-f399ccdb0cc6 | 4 | private void runClient() {
try {
System.out.println("Client: Ready for commands (hit 'enter' for command list)");
BufferedReader bufferedPromptReader = new BufferedReader(new InputStreamReader(System.in));
// Loop taking input until exit
while(!exit) {
System.out.print(">>> ");
parseInput(b... |
cc98cce7-b35a-49aa-b67f-3aac10b8b2fb | 3 | @Override
public Cliente getByCpf(Cliente cliente) {
Cliente clienteLido = null;
try{
conn = ConnectionFactory.getConnection();
String sql = "SELECT nome FROM cliente WHERE cpf LIKE ?";
ps = conn.prepareStatement(sql);
ps.setString(1, cliente.getCpf()... |
39b782da-f81b-4091-b640-26edcf7768bb | 9 | private void showIfInfo (StringBuffer buf, Configuration config)
{
int numIf = config.getNumInterfaces ();
byte epStatus [] = new byte [2];
for (int i = 0; i < numIf; i++) {
try {
Interface intf = config.getInterface (i, 0);
// some devices don't expose these when configured
if (intf == null) {
... |
b8802741-7f82-4b31-9514-fb15833906f3 | 8 | public static void main(String[] args) throws InterruptedException {
int loadedLevel = 0;
startMenu();
while (true) {
if (loadedLevel != level && level > 0) {
loadedLevel = level;
if (level > 0 && !LevelSet.levelExists(level)) {
Sys... |
38bdcb67-f441-4bb5-8a72-131152ba271b | 7 | private void okActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_okActionPerformed
ClienteController control = new ClienteController(mode);
try {
if (!textCodigo.getText().isEmpty()) {
int codigo = Integer.parseInt(textCodigo.getText());
if (c... |
c737ea59-0b8e-420e-b167-aa94ff270f34 | 6 | void updateColumnWidth (CTableColumn column, GC gc) {
int columnIndex = column.getIndex ();
gc.setFont (getFont (columnIndex, false));
String oldDisplayText = displayTexts [columnIndex];
computeDisplayText (columnIndex, gc);
/* the cell must be damaged if there is custom drawing being done or if the alignment is ... |
02ce25fb-8d93-4a9e-ada5-3c8af873e221 | 3 | private int[] totals(int[][] values) {
int[] totals = {0,0,0,0,0,0,0};
for (int i=0; i<7; i++) {
for (int in=0; i<4; i++) {
if (in%2 == 0) {
totals[i] = totals[i]+values[i][in];
} else {
totals[i] = totals[i]-values[i][in];
}
}
}
return totals;
} |
5e1d0829-2081-46a2-a447-8e68252e8ade | 2 | public void fillRandomly() {
for (int i = 0; i < rows; i++)
for (int j = 0; j < columns; j++) {
int r = (int)(256*Math.random());
int g = (int)(256*Math.random());
int b = (int)(256*Math.random());
grid[i][j] = new Color(r,g,b);
}
forceRedraw... |
8b343fce-141b-43d3-9d05-161fb8d8b18f | 9 | public void histogram(Graphics g) {
g.drawLine(rightOffset, 0, rightOffset, getHeight() - bottomOffset);
g.drawLine(rightOffset, getHeight() - bottomOffset, getWidth()-rightOffset, getHeight() - bottomOffset);
((Graphics2D) g).setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING,
RenderingHints.VALUE_TEXT_AN... |
cd23cef4-42fa-4b16-a545-4ebd6850568e | 4 | public Matrix plus(Matrix B) {
Matrix A = this;
if (B.M != A.M || B.N != A.N) throw new RuntimeException("Illegal matrix dimensions.");
Matrix C = new Matrix(M, N);
for (int i = 0; i < M; i++)
for (int j = 0; j < N; j++)
C.data[i][j] = A.data[i][j] + B.data[i]... |
0f596f1d-a18e-4929-adbe-e5a235899a04 | 2 | @Override
public void generate() throws GeneratorException {
Options options = Options.getTo(ConverterTypeTo.PDF).via(ConverterTypeVia.XWPF);
try {
report.generate(options, report.getOutput()+".pdf");
} catch (XDocConverterException e) {
throw new GeneratorException(GeneratorError.PDF_CONVERTION_ERROR,"Err... |
abef3c4a-9f2e-45d6-8fad-d8b23c71e860 | 5 | public static void simpleKMeans(Instances data, Instances originalData) throws Exception {
// create a KMeans clusterer
SimpleKMeans skm = new SimpleKMeans();
skm.setNumClusters(3);
skm.buildClusterer(data);
// evaluate the KMeans clusterer
ClusterEvaluation skmEvaluation = new ClusterEvaluation();
skmEv... |
50721052-8c65-4aa7-bdc1-64e39af97e95 | 9 | private void resizeScreenIfNeeded() {
TerminalSize newSize;
synchronized(resizeQueue) {
if(resizeQueue.isEmpty())
return;
newSize = resizeQueue.getLast();
resizeQueue.clear();
}
int height = newSize.getRows();
int width = newS... |
79808faa-5b23-4fce-8889-dcb6759833ad | 7 | private byte[] crypt_raw(byte password[], byte salt[], int log_rounds) {
int rounds, i, j;
int cdata[] = (int[])bf_crypt_ciphertext.clone();
int clen = cdata.length;
byte ret[];
if (log_rounds < 4 || log_rounds > 31)
throw new IllegalArgumentException ("Bad number of rounds");
rounds = 1 << log_rounds;
... |
b217027f-ddf0-4091-8bd4-c745ed669662 | 0 | public RandomDateGenerator(String tableName, String columnName, Date start, Date end) {
super(tableName, columnName);
this.start = start;
this.end = end;
sdf = new SimpleDateFormat("yyyy-MM-dd");
} |
6fe2cd01-0dd0-49b8-bbbe-f42ea9fb54cb | 7 | private void xmlBuildRootNode(org.w3c.dom.Node node) throws SAXNotRecognizedException, SAXException {
if(node.getNodeType() == org.w3c.dom.Node.ELEMENT_NODE) {
Element elt = (Element) node;
String name = elt.getNodeName();
if(name.equals("DockingPanel")) {
// only one child at most
NodeList children ... |
43899d69-3223-4397-8d19-095ea50c06b2 | 3 | @Override
void replaceChild(@SuppressWarnings("unused") Node oldChild, @SuppressWarnings("unused") Node newChild)
{
// Replace child
if(this._const_ == oldChild)
{
setConst((TConst) newChild);
return;
}
if(this._var_ == oldChild)
{
... |
fd73e1e9-3e09-48f0-93a4-4fe1eb6ab900 | 9 | byte[] readCodewords() throws FormatException {
FormatInformation formatInfo = readFormatInformation();
Version version = readVersion();
// Get the data mask for the format used in this QR Code. This will exclude
// some bits from reading as we wind through the bit matrix.
DataMask dataMask = Data... |
a9e0be4f-8912-4298-af6d-d2fd62441995 | 4 | private ArrayList<Piece> getBlackTeamPieces()
{
ArrayList<Piece> blackTeam = new ArrayList<>();
// adds all pieces, except kings, to their appropriate teams in an ArrayList
for(int y = 0; y < maxHeight; y++)
{
for(int x = 0; x < maxWidth; x++)
{
Piece currentPiece = board.getChessBoardSquare(x, y)... |
6faacd75-f2c6-4809-aef4-d110852cf479 | 7 | public static void main(String[] args) throws IOException {
try {
BufferedReader br = new BufferedReader(new FileReader("Data/Prediction_Similarities/sim.dat"));
String line;
while ((line = br.readLine()) != null) { // while loop begins here
String[] splitLine = line.split("\t");
int userId = Intege... |
215ca878-f22d-4497-88d5-f9f1161bfcde | 4 | public void checkObject () {
Object object = (Object)getOneIntersectingObject(Object.class);
if( object != null ) {
if ( object instanceof CharPlayer ) {
//CharBot.setSlowSpeed(4);
//destroy();
}
else if ( object instanceof CharBot ) {
... |
419dc7e0-6dd1-43de-92d5-57734ca8da6d | 0 | public void setMonths(ArrayList <Month> m)
{
months = m;
} |
0d935885-aaff-4cb8-a0f1-ee64fe5c353e | 3 | public int Expect(String Data, int NumBytes )
{
byte target = 0;
int cnt = 0;
try
{
while ((NumBytes--) != 0)
{
target = file.readByte();
if (target != Data.charAt(cnt++)) return DDC_FILE_ERROR;
}
} catch (IOException ioe)
{
return DDC_FILE_ERRO... |
099735d7-d2ca-4265-b75a-155d37591d0a | 0 | public void setMimeType(String mimeType) {
this.mimeType = mimeType;
} |
924ed508-0d4d-44aa-a6d9-55143d48699c | 7 | final public void Relation_operator() throws ParseException {
/*@bgen(jjtree) Relation_operator */
SimpleNode jjtn000 = new SimpleNode(JJTRELATION_OPERATOR);
boolean jjtc000 = true;
jjtree.openNodeScope(jjtn000);
jjtn000.jjtSetFirstToken(getToken(1));
try {
if (jj_2_65(3)) {
... |
b0b1421c-8a7e-48db-a843-63cbc29c66a5 | 8 | @Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
Message message = (Message) o;
if (idmessage != message.idmessage) return false;
if (content != null ? !content.equals(message.content) : messa... |
df9fcd41-387c-41d2-8255-65e1efc966d4 | 8 | private Tuple<Float, HeuristicData> min(LongBoard state, HeuristicData data, float alpha,
float beta, int action, int depth) {
statesChecked++;
Tuple<Float, HeuristicData> y = new Tuple<>((float) Integer.MAX_VALUE, data);
Winner win = gameFinished(sta... |
f9983e3e-8e8c-440c-a97c-230b60e6b385 | 0 | public Occurrence(String name){
this.docName = name;
this.termFrequency = 1;
} |
7f45bab6-2bcd-4525-8cec-b221588e3002 | 9 | @Override
protected void processTask() {
String visitingUrl = _url.toString();
Document page = null;
try {
// Wikipedia's robots.txt advises a crawl-delay of atleast 1 sec
Thread.sleep(1000);
} catch (InterruptedException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
try {
... |
53a2a587-45c1-4557-ab6f-8cbc40308f2d | 2 | public static String pedirDni(){
boolean correcto=false;
String dni="";
try{
do{
System.out.print("DNI => ");
BufferedReader stdin=new BufferedReader(new InputStreamReader(System.in));
dni=stdin.readLine();
correcto=Operaciones.isdni(dni);
}while(correcto==false);
}catch(Exception e){
Syste... |
ee7cbb86-980d-4c5a-a919-b236104d7b5e | 1 | public static Object getJsonContent(URL url, String method, Type classToConvert){
HttpURLConnection conn=null;
Object obj=null;
try {
conn = HTTPConnector.HTTPConnect(url,method, null);
BufferedReader br = new BufferedReader(new InputStreamReader(conn.getInputStream()));
//set the json file content
ob... |
ee235427-d460-4f93-8964-7ec2d2049705 | 9 | private boolean post2Qc()
{
boolean uploaded = true;
List<String> logFilePaths = testRunInfo.getClientLogFilePaths();
TestRunInfo newTestRun = null;
try {
newTestRun = qcConnector.postResult2Qc(testRunInfo);
if (newTestRun != null) {... |
4c2be268-919d-40b9-8871-cb4a77b41fb9 | 7 | public static UncertainPlayer fromConfiguration(String configuration) {
String name = "uncertain";
int sample_size = -1;
int decision_time = 5000;
long seed = System.currentTimeMillis();
double alpha = 1;
boolean verbose = true;
for (Map.Entry<String,String> entry: Util.parseConfiguration(configuration).... |
33f7988b-99bc-45dc-bb8f-f9b2c99c1823 | 6 | public boolean validarConexion (String n_url, String n_port, boolean seg_int, String n_usu, String n_cla){
boolean valida = false;
if (! n_port.equals("")){
port = n_port;
}
else{
port = "1433";
}
String urlConexion = jdbc+n_u... |
73558002-50bc-4cc6-a46b-4e39d2c466af | 6 | private static int isFullHouse(ArrayList<Card> list) {
assert(list.size() == EFFECTIVE_CARD_NUM);
int setPos = containSet(list);
if (setPos < 0 || setPos == 1 ){
return -1;
}
if (setPos == 0 && list.get(3).getPoint() == list.get(4).getPoint()){
return list.get(0).getPoint();
}
if (setPos... |
5fe3c74d-06bd-4247-9bf6-82fd2e071ded | 3 | public Connection getConnection()
{
try
{
if ((MySQLCore.connection == null) || (MySQLCore.connection.isClosed()))
{
initialize();
}
}
catch (SQLException e)
{
initialize();
}
return MySQLCore.connection;
} |
e417e170-5044-44da-9e86-322de28b6164 | 0 | public void remove()
{
q.clear();
} |
3b6d15a0-a1ac-47a7-a76f-1a837b11a2fc | 7 | public void soften() {
RadialBondCollection rbc = model.getBonds();
RadialBond rb;
synchronized (rbc.getSynchronizationLock()) {
for (Iterator it = rbc.iterator(); it.hasNext();) {
rb = (RadialBond) it.next();
if (contains(rb.getAtom1()) && contains(rb.getAtom2())) {
rb.setBondStrength(SOFT_BOND);... |
07d52d8f-c507-4b08-a8d8-b3a28bb8f5d0 | 7 | public static void main(String[] args) throws IOException {
Scanner sc = new Scanner(new BufferedInputStream(System.in));
PrintWriter cout = new PrintWriter(System.out);
int number, len;
HashMap<String, Integer> hashcount = new HashMap<String, Integer>();
while (true) {
number = sc.nextInt();
len = sc.... |
a1a44303-d03d-4fad-9189-f2a4863ec1e4 | 5 | @Override
public T next()
{
try
{
resultSet.next();
// Instantiate T to fill be able to fill it with result data
T instance = c.newInstance();
// Column names are stored in the metaData
ResultSetMetaData resultSetMetaData = resultSet.getMetaData();
for (int columnIndex = 1; true; col... |
b88de9dc-28f7-4896-b985-d1d43664110d | 4 | @Override
public BlocService getBloc(int i, int j){
BlocService b;
if(!(0<=i && i<super.getNombreColonnes() && 0<=j && j<super.getNombreLignes()))
throw new PreConditionError("unboud i or j");
checkInvariants();
b = super.getBloc(i, j);
checkInvariants();
return b;
} |
b65a2507-5947-4b61-b0be-c50d5b536ea7 | 6 | public String GetLaunchUrlWithTags(String registrationId, String redirectOnExitUrl, String cssUrl, String debugLogPointerUrl, String learnerTags, String courseTags, String registrationTags) throws Exception
{
ServiceRequest request = new ServiceRequest(configuration);
request.getParameters().add("re... |
a03fd72d-5658-48c4-b43e-127eb0352981 | 3 | public static boolean saveNewWord(ArrayList<WordsPair> stringArray, String filename) {
if (stringArray == null) {
return false;
} //Checking parameter for null.
FileWriter output; //Creating reference for filewriter.
try {
output = new FileWriter(new File(filen... |
64b6f0c2-24a7-40e0-ad4a-1fe2c3098ba3 | 8 | public static void main(String[] args) {
Terrain mount1 = Terrain.getMountain();
Terrain mount2 = Terrain.getMountain();
if (mount1.equals(mount2)) {
System.out.println("Son la misma montaña");
}
GridCell map[][] = new GridCell[33][38];
System.out.println("La... |
3ff4bccf-a2db-4ccf-b822-4f4386c86b6b | 9 | protected static Ptg calcDAverage( Ptg[] operands )
{
if( operands.length != 3 )
{
return new PtgErr( PtgErr.ERROR_NA );
}
DB db = getDb( operands[0] );
Criteria crit = getCriteria( operands[2] );
if( (db == null) || (crit == null) )
{
return new PtgErr( PtgErr.ERROR_NUM );
}
int fNum = db.find... |
2e851853-975a-4e17-963f-092f5bac2fa2 | 4 | public void setJSONDataInArray(int id_cod, String cod_rastreio){
JSONParser parser = new JSONParser();
JSONArray a;
all = "";
try
{
String url_link = "http://developers.agenciaideias.com.br/correios/rastreamento/json/" + cod_rastreio;
this.url = new URL(ur... |
951d88c0-1e6e-4188-8284-842fe012ab27 | 9 | protected void keyTyped(char par1, int par2)
{
if (par2 == 15)
{
this.completePlayerName();
}
else
{
this.field_50060_d = false;
}
if (par2 == 1)
{
this.mc.displayGuiScreen((GuiScreen)null);
}
else i... |
90f84934-ee8f-428c-85eb-891aa5cb13c2 | 3 | public ShadingPattern(Library library, Hashtable entries) {
super(library, entries);
type = library.getName(entries, "Type");
patternType = library.getInt(entries, "PatternType");
Object attribute = library.getObject(entries, "ExtGState");
if (attribute instanceof Hashtable) {... |
f31813bc-9a7b-4f93-b92c-c24d4befb9eb | 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... |
de829778-e5cd-4531-ad8d-21560e87da94 | 3 | @Override
public Component getTreeCellRendererComponent(JTree tree,
Object value, boolean selected, boolean expanded,
boolean leaf, int row, boolean hasFocus) {
super.getTreeCellRendererComponent(tree, value, selected,expanded, leaf, row, hasFocus);
if(value instanceof SPFile... |
efff8f4d-550a-485b-bc1e-3a6c73b30d6b | 6 | public void produceEmails(){
emails.removeAll(emails);
try {
Class.forName("com.mysql.jdbc.Driver");
} catch (ClassNotFoundException e) {
System.out.println("Where is your MySQL JDBC Driver?");
e.printStackTrace();
}
PreparedStatement ps = nul... |
1ca9a76c-bbbe-479a-b32a-403dbba495f1 | 5 | public void visitCallMethodExpr(final CallMethodExpr expr) {
if (expr.receiver() != null) {
expr.receiver().visit(this);
}
print(".");
if (expr.method() != null) {
print(expr.method().nameAndType().name());
}
print("(");
if (expr.params() != null) {
for (int i = 0; i < expr.params().length; i++... |
e022d9b6-33db-4916-9c2c-8db9e4a7a57a | 3 | public static boolean intersect(Rectangle a,Rectangle b) {
// boolean x = (a.left() <= b.right() && a.right() >= b.left()) || (a.left() >= b.left() && a.right() <= b.right()) || (a.left() <= b.right() && a.right() >= b.right());
// boolean y = (a.top() <= b.bottom() && a.bottom() >= b.top()) || (a.top() >= b.top() &... |
e2f42dfe-706e-4c17-a0ae-be6954db4aae | 3 | public void nextHit() {
if (current == "Registration") {
if (helpy.isSelected()) {
NewUser newbie = new NewUser();
Helpy helpMe = new Helpy(newbie.txuser.toString(), newbie.pass1.getText());
} else if (needy.isSelected()) {
NewUser newbie = new NewUser();
Needy meNeed = new Needy(newbie.txus... |
0b806578-ef14-4361-92eb-839e414c0cf1 | 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... |
c05bc7f3-4ae3-4885-bebe-f74b8ca83cbb | 5 | private void MergeSortParts(int low, int mid, int high) {
for (int i = low; i <= high; i++) {
tempArray[i] = array[i];
}
int i = low;
int j = mid + 1;
int k = low;
while (i <= mid && j <= high) {
if (tempArray[i] <= tempArray[j]) {
... |
7352e4cd-7c0a-43db-8957-246feb8193f8 | 1 | public ChatServer() {
try {
ssocket = new ServerSocket(port);
} catch (IOException e) {
e.printStackTrace();
}
} |
0e2e987a-978d-43ec-b99a-39b362b352ba | 2 | public void test() throws ModelException
{
Account a = new Account();
FIXMLBuilder builder = new FIXMLBuilder(a);
builder.timeInForce(TimeInForceField.DAY_ORDER);
builder.symbol("OCQLF");
builder.priceType(PriceType.LIMIT);
builder.securityType(SecurityType.STOCK);
builder.quantity(1);
builder.executio... |
ca87dbb1-b602-4f88-96ab-df8a7a83bf39 | 3 | public boolean containsTag(Tag tag)
{
if (hasTag(tag))
return true;
else
{
for (GenericTreeNode child : getChildren())
if (((Area) child).hasTag(tag))
return true;
return false;
}
} |
c13f4977-97bc-4980-8f5a-d371dbf867d4 | 9 | void readAtoms(int modelAtomCount) throws Exception {
for (int i = 0; i < modelAtomCount; ++i) {
readLine();
Atom atom = atomSetCollection.addNewAtom();
int isotope = parseInt(line);
String str = parseToken(line);
// xyzI
if (isotope == Integer.MIN_VALUE) {
atom.elementSy... |
d13c1de0-fec8-4668-b09b-b905a8ab9381 | 1 | public float getDelay(Component cmp) {
return delays.containsKey(cmp) ? delays.get(cmp) : 0;
} |
df6b08e8-2d22-4f88-8b14-d9cd7c19ae46 | 1 | public void lazilyExit() {
Thread thread = new Thread() {
public void run() {
// first, wait for the VM exit on its own.
try {
Thread.sleep(2000);
}
catch (InterruptedException ex) { }
// system is st... |
7cbf517e-70ab-4654-a094-b78ce4a407fd | 2 | public void checkConsistent() {
super.checkConsistent();
if (trueBlock.jump == null || !(trueBlock instanceof EmptyBlock))
throw new jode.AssertError("Inconsistency");
} |
78d0cb1d-b51d-4016-a57b-55e55d3f6949 | 2 | public static ArrayList<UserStocks> getUserStocks() {
ArrayList<UserStocks> usersStocks = new ArrayList<UserStocks>();
File f = new File("userstocks.txt");
try {
FileReader fr = new FileReader(f);
BufferedReader br = new BufferedReader(fr);
String s = "";
while ((s = br.readLine()) != null) {
S... |
00d0bc54-316b-4dfa-872a-491d59d90998 | 4 | @Override
public List<Image> getImages() {
if(images != null)
return images;
File[] imageFiles = directory.listFiles();
Arrays.sort(imageFiles);
images = new ArrayList<Image>();
for(File f : imageFiles)
if(f.isFile() && !f.ge... |
93feda8e-807b-4612-adb6-159b7f112c69 | 8 | private Component cycle(Component currentComponent, int delta) {
int index = -1;
loop : for (int i = 0; i < m_Components.length; i++) {
Component component = m_Components[i];
for (Component c = currentComponent; c != null; c = c.getParent()) {
if (component == c) {
index = i;
break loop;
}
... |
70d8f89b-a11a-4d4e-a478-d0cfbc1a74c0 | 3 | @Override
public TrackerResponse sendRequest (TrackerRequest request, long time, TimeUnit unit) {
long remaining = unit.toNanos(time);
int left = trackers.size();
for (Iterator<Tracker> it = trackers.iterator(); it.hasNext() && remaining > 0;) {
long stTime = System.nanoTime();
... |
84d6efa6-43a6-4b7c-8196-2a3dd57f7913 | 2 | public void setLoc(Atom new_loc)
{
if(location != null)
{
location.contents.remove(this);
}
location = new_loc;
this.outdated |= Atom.positionOutdated;
if(new_loc != null)
{
new_loc.contents.add(this);
}
} |
67a63ec3-f530-4fc1-97d4-2827d59fc390 | 1 | @Override
public List<Integer> update(Criteria beans, Criteria criteria, GenericUpdateQuery updateGeneric, Connection conn) throws DaoQueryException {
List paramList1 = new ArrayList<>();
List paramList2 = new ArrayList<>();
StringBuilder sb = new StringBuilder(UPDATE_QUERY);
String ... |
212cfdc0-ce9f-49ac-ba5e-fe1d4eb62250 | 1 | @Override
public void update(GameContainer container, int delta) throws SlickException {
if(wturn){
wturn = !players[0].go(container, board);
}
else{
wturn = players[1].go(container, board);
}
} |
79d03f13-dc3c-4733-bb14-53bc56a355c1 | 2 | public ArrayList<String> getTags() {
ArrayList<String> tagList = new ArrayList<String>();
String statement = new String("SELECT * FROM " + TagDBTable + " WHERE qid = ?");
PreparedStatement stmt;
try {
stmt = DBConnection.con.prepareStatement(statement);
stmt.setInt(1, quizID);
ResultSet rs = stmt.execu... |
34349913-4e87-4d1e-a18e-55bf48ba1a77 | 3 | private static Person getPerson(String[] personInfo) {
Integer classValue = 0;
if ("50000+".equals(personInfo[41])) {
classValue = 1;
}
Person person = new Person(classValue);
person.addAttribute(0, Double.parseDouble(personInfo[0]));
person.addAttribute(1, D... |
aa5d4dc7-c55d-4b61-8076-7fb52c660511 | 2 | public void disable() throws IOException {
// This has to be synchronized or it can collide with the check in the task.
synchronized (optOutLock) {
// Check if the server owner has already set opt-out, if not, set it.
if (!isOptOut()) {
configuration.set("opt-out"... |
b7eb52f2-dff0-492a-b227-e562e7e73898 | 4 | public synchronized void shutdown(){
if(!shutdown)
shutdown = true;
//Poll the queue and release all objects left in the queue.
while(true){
Reference<?> ref = queue.poll();
if(ref != null){
Resource res = refs.get(ref);//Get the resource by the reference.
refs.remove(ref);//Remove the object ... |
505ae194-0a60-427a-b271-4ec3bfb4d895 | 6 | public ArrayList<String> personToTopicPopulate(String name) {
// arraylist that will populate the topic list based on person selected
ArrayList<String> personToTopic = new ArrayList();
try {
// open the file
File xmlPerson = new File(fileName);
DocumentBuilder... |
c5b168c3-a982-49f9-bd1c-0e8e88fb85cd | 5 | private DelegateGroupVotes createDelegateGroupVotes(
EntityUserAndVote delegate,
Map<Key, DelegateGroupVotes> allVotesMap,
Map<Key, List<EntityUserAndVote>> delegateVotes) {
Key delegateKey = Key.EMPTY;
if (delegate != null) {
delegateKey = delegate.getUser().getId().getKey();
}
... |
f82e61be-e59d-46ad-9aa1-28179652ab73 | 7 | public Expr Shift_Expr() throws ParseException {
Expr e, et;
Token tok;
e = Add_Expr();
label_23:
while (true) {
switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
case SHIFTLEFT:
case SHIFTRIGHT:
break;
d... |
99604980-9383-4014-9120-8653c8f709e7 | 1 | @Override
public float isContextMenuEnabledAt( int x, int y ) {
SelectableCapability selection = getCapability( CapabilityName.SELECTABLE );
if( selection != null ) {
return selection.contains( x, y );
} else {
return 0.f;
}
} |
f619b5ae-a68b-4afe-ab32-72e23a6cbac4 | 6 | private String receiveThinking(long time, LineEval finalEval) {
// Built the pv line
String pvString = "";
for(int i = 0; i < 128; i++) {
if(i == 0) {
pvString += (Move.inputNotation(finalEval.line[0]) + " ");
} else if(finalEval.line[i] == 0) break;
else pvString += (Move.inputNotation(finalEval.lin... |
5542475d-09df-4c52-ab9c-da7fcf81ed9e | 9 | public int compareTo( Object obj ) {
if( obj == null ) {
return( 1 );
}
else if( obj instanceof GenKbAddressByUDescrIdxKey ) {
GenKbAddressByUDescrIdxKey rhs = (GenKbAddressByUDescrIdxKey)obj;
if( getRequiredContactId() < rhs.getRequiredContactId() ) {
return( -1 );
}
else if( getRequiredContac... |
af36de5c-5e98-4595-a079-15337e67d252 | 8 | public void keyPressed (KeyEvent e) {
int key = e.getKeyCode();
// Implemented boolean switches for the collider. Player can't move unless these are true.
if ((key == KeyEvent.VK_W) && (directy == true)) dy = -1;
if ((key == KeyEvent.VK_S) && (directy == true)) dy = 1;
if ((key == KeyEvent.VK_... |
7361be8a-62e7-461f-87e4-b013d6171eb1 | 3 | private void activity_submitModify_buttonActionPerformed(ActionEvent evt,
String courseID, String actName) {
boolean prog; boolean group;
if(activity_type_combo.getSelectedItem().toString().equalsIgnoreCase("Programming"))
prog = true;
else
prog = false;
if(activity_group_checkbox.isSelected())
gro... |
7cc91ae3-0ac6-49cc-8b56-a1e672172beb | 4 | public static boolean lostOnlyPart(Robot paramRobot, Class paramClass) {
Enumeration localEnumeration = GameApplet.thisApplet.getGameState().getRobotPartPatterns().elements();
while (localEnumeration.hasMoreElements())
if (paramClass.isInstance(localEnumeration.nextElement()))
return false;
Ro... |
6b1c5260-d874-4463-9b1b-402e966f8312 | 5 | public static SignalAspect mostRestrictive(SignalAspect first, SignalAspect second) {
if (first == null && second == null)
return RED;
if (first == null)
return second;
if (second == null)
return first;
if (first.ordinal() > second.ordinal())
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.