method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
92099848-8284-4afd-b1dd-c1574a393127 | 3 | @Override
public boolean equals(Object o){
if(o == null){
return false;
} else if (o.getClass() != this.getClass()){
return false;
} else if(this.word.equals(((Node)o).getWord())){
return true;
}
return false;
} |
b226f27f-11af-4364-a587-6b9bab936486 | 1 | public boolean isIDexist(int id)
{
String select="select count(*)from citedlist where paperid="+id;
int count=0;
count=sqLconnection.Count(select);
if(count!=0)
return true;
else
return false;
} |
e7a79300-5f43-4546-a432-44f7eae3e1db | 1 | public static void main(String[] args)
{
final Preferences prefs = Preferences.userRoot().node(Prefs.class.getName());
try
{
prefs.clear();
} catch (Exception e)
{
}
} |
9ba7ebd2-54a0-4d36-aa35-50e11fdacabd | 8 | public void actionPerformed(ActionEvent ae) {
if( ae.getSource() == this.searchQuery || ae.getSource() == this.search ) {
//displays results matching the query typed into the search box
ArrayList<Item> results = this.library.searchByTag( this.searchQuery.getText() );
this.currentListModel = new DefaultLi... |
9205ef8b-5ed0-42e4-8220-8190613dde75 | 6 | public ListNode deleteDuplicates(ListNode head) {
if (head == null)
return null;
ListNode p = head;
ListNode t = new ListNode(0);
t.next = head;
head = t;
p = p.next;
while (p != null) {
if (t.next.val == p.val) {
p = p.n... |
f523bc77-6d79-4939-a4e4-381fe377ee1b | 8 | static void setup_connection(FM_CH CH) {
IntSubArray carrier = new IntSubArray(out_ch, CH.PAN); /* NONE,LEFT,RIGHT or CENTER */
switch (CH.ALGO) {
case 0:
/* PG---S1---S2---S3---S4---OUT */
CH.connect1 = new IntSubArray(pg_in2);
CH.connect2 =... |
afbe45e0-c913-4ae5-bc21-2b715d23fb04 | 3 | public boolean isInside(int mx, int my) {
return (mx > x && mx < x + width) && (my > y && my < y + height);
} |
854dc862-d278-414c-8d07-43015bde8ace | 8 | public Installation[] selectByActivity ( int activityId ) {
Connection con = null;
PreparedStatement statement = null;
ResultSet rs = null;
List<Installation> installations = new ArrayList<Installation>();
try {
con = ConnectionManager.getConnection();
String searchQuery = "SELECT * FROM i... |
ef1c6407-5954-4bb5-9195-87dbddde2f8e | 0 | public void setAuthor(Author author) {
this.author = author;
} |
1d28bb74-0639-4a4a-81a2-910186536f19 | 5 | private void isDogWithAllData(Dog dog) {
boolean hasError = false;
if(dog == null){
hasError = true;
}
if (dog.getName() == null || "".equals(dog.getName().trim())){
hasError = true;
}
if(dog.getWeight() <= 0){
hasError = true;
}
if (hasError){
throw new IllegalArgumentExc... |
d2500db5-8ec8-47c2-ba74-93d3eb4707a0 | 0 | public static int hue(int color) {
double red = (color & RED_MASK) >> 16;
double green = (color & GREEN_MASK) >> 8;
double blue = (color & BLUE_MASK);
return (int)Math.atan2(Math.sqrt(3)*(green - blue), 2*red - green - blue);
} |
0a5d2dad-b707-4848-a741-dcd591d2fa8d | 6 | * @param y The y-coordinate.
* @param column The column the coordinates are currently over.
* @param row The row the coordinates are currently over.
* @return <code>true</code> if the coordinates are over a disclosure triangle.
*/
public boolean overDisclosureControl(int x, int y, Column column, Row row) {
i... |
24660359-73f0-4179-9dc2-4bce35385eb5 | 3 | void updateInOut(FlowBlock successor, SuccessorInfo succInfo) {
/*
* First get the gen/kill sets of all jumps to successor and calculate
* the intersection.
*/
SlotSet kills = succInfo.kill;
VariableSet gens = succInfo.gen;
/*
* Merge the locals used in successing block with those written by this
... |
c6fb7e30-8c3a-45e4-9d4e-bc76876b90bb | 7 | private void scale(final float m, final float[] a, int offa) {
final float norm = (float) (1.0 / m);
int nthreads = ConcurrencyUtils.getNumberOfThreads();
if ((nthreads > 1) && (n >= ConcurrencyUtils.getThreadsBeginN_1D_FFT_2Threads())) {
nthreads = 2;
final int k = n / n... |
4b71df24-e1e9-4ffb-9420-056c711f0ae8 | 2 | public boolean equals(final Object value) {
if (!(value instanceof SourceValue)) {
return false;
}
SourceValue v = (SourceValue) value;
return size == v.size && insns.equals(v.insns);
} |
585041d8-1053-43f3-af17-db476e284e9c | 0 | public Integer getInhusa() {
return inhusa;
} |
709a4487-48a0-46ba-8aa0-78aaeeaa4474 | 8 | private void positionPlayerKickOff(int teamNumber) {
switch (teamNumber) {
case TEAM_1:{
Random generator = new Random();
int kickOffPlayerID = playmode.getTeams()[teamNumber].getUser()[generator.nextInt(playmode.getTeams()[teamNumber].getUser().length)].getID();
GameObject ball = gameObjects.get("BALL");
... |
01105dd1-195f-42e6-ab51-84433aca90ba | 2 | private void validateContext() {
readyForExchange_ = localRoutingTable_.getLocalhost() != null
&& remoteRoutingTable_ != null
&& remoteRoutingTable_.getLocalhost() != null;
} |
1e880487-6bf2-48ce-abd4-f55be9d42f6b | 2 | public Entry getEntry(int index) {
for (int i = 0; i < entries.length; i++) {
if (entries[i].index == index) {
return entries[i];
}
}
return null;
} |
09b17289-8e5c-4b4e-bcd0-362597de2bbb | 6 | private void persist(PersistAction persistAction, String successMessage) {
if (selected != null) {
this.setEmbeddableKeys();
try {
if (persistAction != PersistAction.DELETE) {
this.ejbFacade.edit(selected);
} else {
... |
75e862e5-de95-4b5e-a0db-50a69e06399f | 6 | public void sentencesWithSameWords(String resultFilePath)
throws IOException{
if(text == null) return;
int maxNumberOfWords = 0;
ArrayList<Sentence> result = new ArrayList<Sentence>();
for(int i = 0; i < text.numberOfParagraphs(); i++){
Paragraph currParagraph = t... |
af4375cb-c0a9-48d4-ae2a-43d1ad753c8f | 8 | public String getAccessString() {
StringBuffer sb = new StringBuffer();
if (AccessFlags.isPublic(this.accessFlags))
sb.append("public ");
if (AccessFlags.isPrivate(this.accessFlags))
sb.append("private ");
if (AccessFlags.isProtected(this.accessFlags))
... |
a73dd9e3-a261-4a0d-907d-6b04c33e172c | 7 | private void actualizarTabla(){
if (a.getSizeArray() < 15) {
for (int i = 0; i < 15; i++) {
if (i < a.getSizeArray())
tabla.setValueAt(a.getProc(i).getNombre(), i, 0);
else
tabla.setValueAt("", i, 0)... |
c7e12207-75f6-4677-a739-4789fd181677 | 1 | public static void listProjectsEmployees(EntityManager entityManager) {
TypedQuery<Project> query = entityManager.createQuery(
"select distinct p from Project p join fetch p.employees",
Project.class);
List<Project> resultList = query.getResultList();
entityManager.close();
for (Project project : resu... |
cb61fd2a-93f8-4546-a040-10ddbdc3c719 | 4 | @Override
public void draw(Graphics2D g) {
if (dead) return;
AffineTransform old = g.getTransform();
if (rotate) {
AffineTransform at = g.getTransform();
at.rotate(angle, pos.x, pos.y);
g.setTransform(at);
}
g.drawImage(image, (int) pos.x, (int) pos.y, Game.w);
g.setTransform(old);
i... |
1a430bb2-49b8-4f54-905f-ce21c8b790eb | 7 | public boolean remove(Link<Integer> link)
{
Link<Integer> position = this.head;
if (link == null || this.head == null)
{
return false;
}
if (link.equals(this.head))
{
this.head = link.getNext();
if (this.head == null)
{
... |
49b79c35-a0ea-42c1-b39e-92b2665840ca | 0 | public Metadonnee getMetadonnee() {
return metadonnee;
} |
e4578375-42ed-415f-8eaa-6f821dccbd33 | 8 | public boolean batchFinished() throws Exception {
if (getInputFormat() == null)
throw new IllegalStateException("No input instance format defined");
Instances toFilter = getInputFormat();
if (!isFirstBatchDone()) {
// filter out attributes if necessary
Instances toFilterIgnoringAttri... |
8fd125e1-a290-4059-8d5e-bd67ee94c1ed | 1 | private void assertExteriorRing()
{
if (coordinates.isEmpty())
{
throw new RuntimeException("No exterior ring defined");
}
} |
c77f8dc6-9ca9-476c-936d-3dc77edd09d2 | 3 | public static ServiceConditionEnumeration fromString(String v) {
if (v != null) {
for (ServiceConditionEnumeration c : ServiceConditionEnumeration.values()) {
if (v.equalsIgnoreCase(c.toString())) {
return c;
}
}
}
throw new IllegalArgumentException(v);
} |
be3c6330-de58-4c8d-af66-3de0fe0e0cdb | 1 | public JTextField getPassword(){
String pass=passT.getText();
String confirmedPass=confirmPassT.getText();
if(pass.equals(confirmedPass)){
return passT;
}else return null;
} |
15d45b82-c909-4624-a92a-cd780c05bedc | 4 | private void displayBoard(TicTacToeBoard state) {
for (int row = 0; row < TicTacToeBoard.SIZE; row++) {
for (int col = 0; col < TicTacToeBoard.SIZE; col++) {
if (state.getState(row, col) == TicTacToeBoard.X) {
cellLabel[row * TicTacToeBoard.SIZE + col].setText("X");
} else if (state.getState(row, col)... |
2bf77048-844e-429e-821a-55389fb112fa | 8 | public String[] someoneElse(boolean place)
{
try{
driver.get(baseUrl + "/content/lto/2013.html");
//global landing page
driver.findElement(By.xpath("/html/body/div[2]/div/div/div/div/div/div/div[3]/ul/li/a")).click();
//Brunei landing page - Order Now button
driver.findElement(By.xpath("/html... |
bd9f8cc2-5fd5-4341-b7a8-48de142d690b | 1 | public boolean fichierMove(File ancien_emplacement, File nouvelle_emplacement) {
if (ancien_emplacement.renameTo(nouvelle_emplacement))
return true;
else
return false;
} |
3cade567-ee12-4e7b-af80-bacbf7071a1e | 8 | public static boolean legalInput(int x1, int x2, int x3, int x4){
if ((x1 >= 0 && x1 <= 7) && (x2 >= 0 && x2 <= 7) && (x3 >= 0 && x3 <= 7) && (x4 >= 0 && x4 <= 7)){
return true;
}
return false;
} |
42476425-2b1b-4a81-893e-af177bf86a13 | 1 | private void action(final String input) {
System.out.println(MSG_INACTION+input);
for (int i = 0;i<input.length();i++) {
printADigit(input.substring(i,i+1));
}
} |
e5b0beaa-54bb-4514-9bd3-8b4d8a8dd945 | 1 | public RangeType(ReferenceType bottomType, ReferenceType topType) {
super(TC_RANGE);
if (bottomType == tNull)
throw new jode.AssertError("bottom is NULL");
this.bottomType = bottomType;
this.topType = topType;
} |
58cf79dd-14d1-4979-b8da-b9146a376d27 | 6 | public EmprestimoComboBox pesquisarTodosCodigoCidadaoEstoque() {
EmprestimoComboBox emprestimoComboBox = new EmprestimoComboBox();
Connection connection = conexao.getConnection();
try {
String valorDoComandoUm = comandos.get("pesquisarTodosCodigoCidadaoEstoque");
Prepared... |
4d9ca69a-9fcc-4c0d-8cf4-4151002ce523 | 3 | private JSONWriter end(char mode, char c) throws JSONException {
if (this.mode != mode) {
throw new JSONException(mode == 'a'
? "Misplaced endArray."
: "Misplaced endObject.");
}
this.pop(mode);
try {
this.writer.write(c);
}... |
6f026829-be42-4545-a07c-e5bfbf94bcc8 | 2 | @Override
public Component getListCellRendererComponent(JList<? extends RiverComponent> list,
RiverComponent value, int index, boolean isSelected, boolean cellHasFocus) {
if (isSelected) {
setBackground(list.getSelectionBackground());
setForeground(list.getSelectionForeground());
... |
0a20b766-2f7a-4a76-b4c4-be09ae7715fe | 6 | private void saveFile(HashSet<String> words, String name)
{
File file;
FileWriter writer = null;
file = new File(this.getDataFolder(), name);
if(!file.exists())
{
try {
file.createNewFile();
} catch (IOException e) {
logger.severe("[" + pdfdescription + "] Unable to create login config fi... |
21438812-580f-4ede-8831-6b33599d5db6 | 7 | public static boolean verifyNewPatient(NewPatientPage newPatient){
Patient patient = new Patient();
if(InputChecker.name(newPatient.getfName().getText())){
patient.setFirstName(newPatient.getfName().getText());
if(InputChecker.name(newPatient.getfName().getText())){
patient.setLastName(newPatient.getlName... |
54a43260-25b1-4c96-b857-c82769986b31 | 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... |
14967f27-3b1b-4470-869c-9b034c4fdd44 | 5 | protected synchronized void storeContent() throws IOException, MediaWiki.MediaWikiException {
final Map<String, String> getParams = paramValuesToMap("action", "query", "format", "xml", "prop", "revisions", "rvprop", "content", "revids", Long.toString(revisionID));
final String url = createApiGetUrl(getParams);
... |
985af080-2850-46c1-9c40-f6599b4e977f | 3 | private String scanDirectiveName () {
int length = 0;
char ch = peek(length);
boolean zlen = true;
while (ALPHA.indexOf(ch) != -1) {
zlen = false;
length++;
ch = peek(length);
}
if (zlen)
throw new TokenizerException("While scanning for a directive name, expected an alpha or numeric character bu... |
c9bef217-fd4a-4b24-a3db-d7bf2fdaf440 | 6 | public List getChangedComponents() {
ArrayList components = YUIToolkit.getViewComponents(controller.getView());
Iterator it = components.iterator();
ArrayList result = new ArrayList();
while (it.hasNext()) {
Object comp = it.next();
boolean changes = false;
... |
c41bceb0-d059-4d0e-a6de-9e76362f9ca4 | 5 | public boolean hasChanged()
{
if ( parent != null && parent.hasChanged() )
return true;
if ( !pos.equals( oldPos ) )
return true;
if ( !rot.equals( oldRot ) )
return true;
if ( !scale.equals( oldScale ) )
return true;
return false;
} |
e9699751-9390-480e-8673-d9f02df84896 | 7 | protected int advQuoted(String s, StringBuffer sb, int i)
{
int j;
int len= s.length();
for (j=i; j<len; j++) {
if (s.charAt(j) == '"' && j+1 < len) {
if (s.charAt(j+1) == '"') {
j++; // skip escape char
} else if (s.charAt(j+1) == fieldSep) {... |
1847bb4e-a830-4065-bbeb-87a156aeff0d | 1 | public NewFactionEditor() {
setTitle("New Faction");
setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
setBounds(100, 100, 300, 150);
getContentPane().setLayout(new BorderLayout());
contentPanel.setBorder(new EmptyBorder(5, 5, 5, 5));
getContentPane().add(contentPanel, BorderLayout.CENTER);
contentPanel... |
c85ce484-88d5-449e-ba27-00c6647c47c0 | 9 | @Override
public void keyReleased(KeyEvent e) {
if (e.getKeyCode() == KeyEvent.VK_ENTER)
actionPerformed(new ActionEvent(commandLineButton, 0, ""));
if (e.getKeyCode() == KeyEvent.VK_UP && commandLineHistoryPointer > -1
&& commandLineHistory.size() != 0) {
commandLineField
.setText(commandLineHistor... |
d155e7aa-4a70-4f8c-b929-a58022063dae | 9 | private void calculate() {
if(model == null) return;
Double factor = jTextFieldFactor.getText().equals("") ? 0.0 : Double.parseDouble(jTextFieldFactor.getText());
Double fieldA = jTextFieldA.getText().equals("") ? 0.0 : Double.parseDouble(jTextFieldA.getText());
Double ... |
e74d8de1-316a-460d-9347-c461385ff428 | 4 | public void init() {
BmTestManager bmTestManager = BmTestManager.getInstance();
if (!JMeterUtils.getPropDefault(Constants.BLAZEMETER_TESTPANELGUI_INITIALIZED, false)) {
JMeterUtils.setProperty(Constants.BLAZEMETER_TESTPANELGUI_INITIALIZED, "true");
final IRunModeChangedNotifica... |
5df2ddd7-0ce7-439b-b5d7-0ebe01350eb2 | 0 | public void setIdCombinacion(int idCombinacion) {
this.idCombinacion = idCombinacion;
} |
7591879d-a3e2-4915-ba7e-b6bc4aaa1acb | 3 | public TreeNode buildTree(int[] inorder, int[] postorder) {
int length = inorder.length;
if(length ==0)
return null;
int pos = indexOf(inorder,postorder[length-1]);
TreeNode node = new TreeNode(postorder[length-1]);
if(pos >0)
node.left = buildTree(Arrays.... |
7acdc0cb-a0e9-43b1-a709-24c2ec58a73c | 1 | public java.security.cert.X509Certificate[] getAcceptedIssuers() {
java.security.cert.X509Certificate[] chain = null;
try {
TrustManagerFactory tmf = TrustManagerFactory.getInstance("SunX509");
KeyStore tks = KeyStore.getInstance("JKS");
tks.load(this.getClas... |
09d9b209-6191-4dad-90d0-6fa32c80757f | 4 | public static void saveLogs() {
if(logsBuffer.isEmpty()) return;
try {
PrintWriter pw = new PrintWriter(new BufferedWriter(new FileWriter(logFile, true)));
String logStr = null;
while((logStr = logsBuffer.poll()) != null) {
pw.println(logStr);
}
pw.close();
} catch (FileNotFoundException e) {
... |
5192bce9-8a27-47a3-ab9d-d71af92ca5e6 | 2 | public static int search_type_by_name(Type_table type_table, String name) {
int num = type_table.type_name.size();
for (int i = 0; i < num; i++) {
if (type_table.type_name.get(i).toString().equals(name)) {
return i;
}
}
return -1;
} |
7a9b4789-72cf-43ba-a8a1-38de594f4377 | 4 | public void keyPressed(KeyEvent e) {
// react to pressing escape
if(e.getKeyCode() == java.awt.event.KeyEvent.VK_ESCAPE) {
if(nodeToDrag != null) { // stop dragging a node, and undo
nodeToDrag.getPosition().assign(nodeToDragInitialPosition);
nodeToDragDrawCoordCube = null;
nodeToDrag = null;
... |
2f005f38-b66a-47cb-a6af-c1cb9393c707 | 3 | protected void remove( TrieSequencer<S> sequencer )
{
// Decrement size if this node had a value
setValue( null );
int childCount = (children == null ? 0 : children.size());
// When there are no children, remove this node from it's parent.
if (childCount == 0)
{
parent.... |
99cf1945-cbd0-462d-8ea6-a06e0e1dcbed | 3 | public GuiLobby(boolean Op) {
host = Op;
compList.add(0, Leave);
if(host){
compList.add(1, Start);
compList.add(2, Kick);
Server.startServer();
}
try {
Rocket.getRocket().network.connect();
} catch (UnknownHostException e) {
System.err.println("Couldn't find host");
} catch (IOException e) ... |
7733fe2b-2664-4ed1-9b4a-597e4289399c | 5 | public LinkDigest putFile(final InputStream rawBytes, final LinkDigest prevChainHead) throws IOException {
if (mUpdates == null) {
IOUtil.silentlyClose(rawBytes);
throw new IllegalStateException("Not updating. Did you forget to call startUpdate?");
}
if (rawBytes == null... |
1254256d-81c3-4cf9-9665-d6e056cd6f8c | 4 | public List<UserMaster>resContactInfo(String twitterID){
query = em.createNamedQuery("UserMaster.findByTwitterID").setParameter("twitterID", twitterID);//UserMasterからUser情報をすべてとってくるクエリを飛ばしている
if(!query.getResultList().isEmpty()){
um=(UserMaster)query.getSingleResult();
query = em... |
c20c34bf-822a-47fb-86ad-349dad91e316 | 6 | @Override
public void unsafe_set(int row, int col, double val) {
if( row != 0 && col != 0 )
throw new IllegalArgumentException("Row or column must be zero since this is a vector");
int w = Math.max(row,col);
if( w == 0 ) {
a1 = val;
} else if( w == 1 ) {
... |
0eda61aa-d4c9-4f66-ad8f-6558686e0d30 | 2 | private Texture loadTexture(String key){
try {
return TextureLoader.getTexture("PNG", new FileInputStream(new File("res/" + key + ".png")));
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
return null;
} |
8b52d225-4f61-49a7-9990-4e1145f38db7 | 5 | public ContentObject getObjectAt(int x, int y, ContentType type) {
if (type instanceof RegionType)
return getRegionAt(x, y);
else if (type instanceof LowLevelTextType) { //Text lines, word, glyph
for (ContentIterator it = this.iterator(RegionType.TextRegion); it.hasNext(); ) {
Region reg = (Region)it.next... |
70d6126a-3eb3-41c0-9e8d-4a10defa6ea5 | 7 | public static void main(String[] args) {
Random randomNumbers = new Random();
int frequency1 = 0;
int frequency2 = 0;
int frequency3 = 0;
int frequency4 = 0;
int frequency5 = 0;
int frequency6 = 0;
int face;
for(int ... |
fe91add6-2fa8-4602-b8e0-a90184e317a1 | 2 | public static void paintRedN8(Image image, int x, int y) {
for (int i = -1; i < 2; i++) {
for (int j = -1; j < 2; j++) {
paintRed(image, x + i, y + j);
}
}
} |
c894869d-a20a-4a35-b0bf-33798f775162 | 1 | private boolean isAParameterRequest() throws IOException {
try {
String secondElement = requestArray[1];
String[] splitOnMark = secondElement.split("\\?");
String parameterString = splitOnMark[0];
return parameterString.equals("/parameters");
} catch (ArrayIndexOutOfBoundsException e) {... |
6ba18620-131b-4dec-95b1-8c884bf0d56d | 7 | public void calculatePosition() {
double sigma1, tsig1, tu1, sa, ca, sa1, ca1, A, B, twosm;
double cu1, su1, uu;
double sigma;
int nIters = 0, nMaxIters = 10;
double c2sm, ssig, csig, dsig = 0.0, lastdsig;
double lambda, C;
double x, y;
double a = ellipsoid.getSemiMajorAxis();
double f = ellipsoid.ge... |
f940c155-764c-4ee5-9d0b-042396539965 | 9 | private void checkAssignedValue(Identifier id, AssignedValue val)
throws SemanticsException {
int val_size = val.oidValue.size();
/* Has the oid value hierarchy?? */
if (val_size < 2) {
Message.error(id, "has no parent defined (need 2 oids at lea... |
3d13a752-4629-421f-8922-1d3bf6315a5e | 7 | public void renderTile(int xp, int yp, Tile tile) {
xp -= xOffset;
yp -= yOffset;
for (int y = 0; y < tile.getSpriteSize(); y++) {
int ya = y + yp;
for (int x = 0; x < tile.getSpriteSize(); x++) {
int xa = x + xp;
if (xa < -tile.getSpriteSize() || xa >= width || ya < 0 || ya >= height) break;
if... |
26f28b41-b7fd-4299-a8ce-a044dd5da4ce | 3 | @SuppressWarnings("deprecation")
@Override
public boolean execute(AdrundaalGods plugin, CommandSender sender, String... args) {
if(args.length < 1)
return false;
final Shrine s = AGManager.getShrineHandler().getShrine(args[0]);
if(s == null)
Messenger.sendMessage(sender, "Shrine not found");
... |
3bcc5fe2-53ea-41bd-a475-d71d7f4f1a1c | 2 | @Override
public void run() {
super.run();
primeStatusIdCache();
for ( ;; ) {
try {
procTweets( searchForTweets() );
sleep( 8000l ); // Wait 8 seconds
} catch ( InterruptedException e ) { }
}
} |
f3363ba0-7be0-4c0b-b6e3-e1423b24444e | 1 | public static byte[] rByte(String packagestr){
byte[] tmp = new byte[packagestr.length()/2];
for (int i=0;i<packagestr.length()/2;i++){
tmp[i]=Byte.parseByte(packagestr.substring(i*2,i*2+2));
//int j = (String.valueOf(("0x"+packagestr.substring(i*2,i*2+2)).;
}
return tmp;
... |
6d45efec-9c8f-42de-a013-4f54f87d68c3 | 0 | @Test
public void test_maxGold(){
assertNotNull(board);
assertEquals(board.maxGold(), 0);
int maxGold = 3;
Pawn pawn = mock(Pawn.class);
when(pawn.getGold()).thenReturn(maxGold);
board.addPawn(pawn);
assertEquals(maxGold, board.maxGold());
} |
a355098b-4f0d-4731-9ea6-ad2fb366fbf8 | 9 | public void update() {
if (listAwardNames.getSelectedValue() == null) {
return;
}
clearErrors();
if (txtAwardName.isMessageDefault() || txtAwardName.getText().isEmpty()) {
Util.setError(lblNameError, "Award name cannot be left blank");
return;
... |
0ce8ffcb-a550-46fb-98fa-8dac36bcb255 | 3 | private void dfs(Digraph<?> G, Object v) {
this.marked.put(v, true);
this.reachable.add(v);
for (Object temp : G.getAdjacentVertices(v)) {
if (!marked.get(temp)) {
dfs(G, temp);
}
}
} |
b0e059ed-4092-4fcf-b035-89aee1f6ed51 | 9 | @Test
public void testIntWalkManager() throws IOException {
int nvertices = 33333;
IntWalkManager wmgr = new IntWalkManager(nvertices, 40000);
int tot = 0;
for(int j=877; j < 3898; j++) {
wmgr.addWalkBatch(j, (j % 100) + 10);
tot += (j % 100) + 10;
}
... |
c5873263-6c10-42f3-b5e2-554e466b072e | 4 | public static List<Supplier> formatOutputs(JSONArray results) {
final List<Supplier> ret = new ArrayList<Supplier>();
for (int i = 0; i < results.length(); i++) {
JSONObject r = null;
if (results.get(i) instanceof JSONObject)
r = (JSONObject) results.get(i);
if (r != null) {
final Supplier c = new... |
2c84bce3-10e1-4af9-a663-f1056d9dfa61 | 8 | public static void main(String[] args) throws IOException {
BufferedReader f = new BufferedReader(new FileReader("agrinet.in"));
PrintWriter out = new PrintWriter(new BufferedWriter(new FileWriter("agrinet.out")));
n = Integer.parseInt(f.readLine());
graph = new int[n][n];
for(int i=0; i<n; i++) {
Strin... |
cd7f3341-90ad-4489-a854-8fbc959a07bb | 3 | public void execute() {
int nThreads = Runtime.getRuntime().availableProcessors();
ArrayList<Thread> threads = new ArrayList<Thread>();
for(int i=0; i < nThreads; i++) {
Thread t = new Thread(new RMATGenerator(numEdges / nThreads));
t.start();
threads.add(t);... |
3b1b7daf-c3a2-4ea5-a241-7194f0df3243 | 9 | * @param getterName - Name of the getter method for the field name to sort by
* @param order Whether to sort in asc or desc order
*/
public <T> void sort(ArrayList<Course> list, String getterName, final int order){//help order makes no sense. please document how it works.
try {
final Method getter=Course.clas... |
2d308c92-9fbd-4e10-b957-c589919a77a0 | 6 | public void move(int ax, int ay, int bx, int by) {
char t = this.b[ax][ay].toString().charAt(1);
boolean c = this.b[ax][ay].getColor();
this.b[ax][ay] = new Blank(true);
switch (t) {
case 'P':
this.b[bx][by] = new Pawn(c);
break;
case 'R':
this.b[bx][by] = new Rook(c);
break;
case 'N':
... |
76e0585c-ad0e-4cf3-ae52-50adfeb7daf4 | 8 | public static void caseG(){
//we have a double with the highest average
//need to iterate through the list of students and find the one who has that average.
boolean correct_input = false;
while(!correct_input){
if(students_in_courses.size() == 0){
correct_input = true;
JOptionPane.showMessageDi... |
01b9a720-cc5e-4e07-8528-c15c53a62e3c | 0 | public void setFormattedLocation(String formattedLocation) {
this.formattedLocation = formattedLocation;
} |
0203d4ee-51ff-4ebc-a993-d6be5ed2c183 | 2 | public void modificarOtro(int id, ArrayList datos)
{
// Cambiamos todos los datos, que se puedan cambiar, a minúsculas
for(int i = 0 ; i < datos.size() ; i++)
{
try{datos.set(i, datos.get(i).toString().toLowerCase());}
catch(Exception e){}
}
biblioteca... |
1c94bad9-7653-4706-bbfa-3828d6cb0416 | 5 | public static void addClasspath(String component) {
if ((component != null) && (component.length() > 0)) {
try {
File f = new File(component);
if (f.exists()) {
URL key = f.getCanonicalFile().toURL();
if (!classPath.contains(key... |
d94e586c-90a0-4eb5-9602-bb8dd17d059e | 0 | public void setXAxisDeadZone(float zone) {
setDeadZone(xaxis,zone);
} |
daf8e0cb-89bf-4ef8-ba3a-456bd38254aa | 7 | public static void main(String[] args) {
Scanner in = new Scanner(System.in);
boolean isRunning = true;
int c = 0;
while (c < 10 || c > 20) {
System.out.print("Choose the size of your cave (10-20): ");
while(!in.hasNextInt()) {
System.out.print("... |
11ff199a-403c-4156-8558-8c6cac93bebc | 6 | private void LoadContent(int img) {
try {
if (img == 0) {
URL trackImgUrl0 = this.getClass().getResource("/raceresources/resources/images/track0.png");
trackImg = ImageIO.read(trackImgUrl0);
} else if (img == 1) {
URL trackImgUrl1 = this.ge... |
73f7db41-bca7-49cb-bc26-e1f8a31388c0 | 4 | @Test
public void canGetAllCategories() {
CategoryDAO cd = new CategoryDAO();
List<CategoryModel> categories = null;
try {
categories = cd.getAllCategories();
} catch (WebshopAppException e) {
e.printStackTrace();
fail("Exception");
}
boolean findTestCategory = false;
for (CategoryModel cat : c... |
220321b3-9a9e-4548-9bbe-5446d5a0fcdf | 8 | public ArrayList <Vehicle> DBvehicleRouter (Object sysObject,
String action){
//local container
ArrayList <Vehicle> temp;
try{
if (sysObject instanceof String && "VIEWALL".equals(action)
&& "MANAGER".equals(sysObject)){
... |
bc1611b4-d6f6-4e33-b6ad-a06b9964fcc0 | 8 | public void enregistrerHouse(MemoryAction m ){
int drap=0;
int j =0;
while( j <20 && drap ==0 )
{
if(houseList[j] == null) drap = j;
else if(j == 19) drap =j;
j++;
}
for( int g = drap; g>=0 ;g-- ){
if (g != 19) houseList[g+1] =houseList[g];
else houseList[19] = houseList[18];
}
houseLis... |
6637a49c-77c6-4282-af6e-c0f9cc4c7bec | 3 | @Override
public Object getValueAt(final int row, final int column) {
if (column == 0) {
return AvailableTextFiles.getInstance().getAvailableTextFiles().get(row).getName();
}
else if (column == 1) {
return AvailableTextFiles.getInstance().getAvailableTextFiles().get(row).getAbsolutePath();
}
else if (c... |
0a941db7-8d66-4e79-88e0-85a075bf7c6b | 1 | public void cancelMove() {
if(canCancelMove())
willCancelMove = true;
} |
19a47264-b63a-4a4d-8b18-aed785c5f689 | 2 | public Neuron getNeuron(Integer layer, Integer column) {
if (layer < neurons.size()) {
if (column < neurons.get(layer).size()) {
return neurons.get(layer).get(column);
}
}
throw new IllegalArgumentException(
"Error: The given Range is not within the Borders of this Perceptron!");
} |
20551652-f8cc-4a3f-96d6-c6cd24896501 | 0 | public static void msg(Object desc) {
JOptionPane.showMessageDialog(null, desc);
} |
3e719238-7209-4d1b-b148-0786dd437e5c | 0 | public Map() throws JAXBException {
JAXBContext context = JAXBContext.newInstance(Row.class);
this.unmarshaller = context.createUnmarshaller();
} |
45398cbe-aa96-44f8-86ee-9c9b41db900d | 1 | public void addNotes(String text)
{
String eol = System.getProperty("line.seperator");
if(this.meetingNotes==null)
{
this.meetingNotes = text;
}else{
this.meetingNotes = this.meetingNotes + eol + text;
}
} |
617e7844-4819-45a7-8af7-95115135c667 | 8 | public void initial() throws IOException {
double[] positions = null;
// initial pbest and particles
for (int i = 0; i < swarm_size; i++) {
positions = new double[dimension];
for (int j = 0; j < dimension; j++) {
positions[j] = (Math.random() * (range_max - range_min) + range_min)
* (Math.random(... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.