method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
cf34b0ac-f217-4d61-a9d5-90467369c833 | 3 | @Test
public void testTimeTrue() {
try {
for (int i = 0; i < 1000; i++) {
account.buyShare("daniel", "BMW", 2);
account.sellShare("daniel", "BMW", 2);
}
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
BuySellHistory history = account.getA... |
36cf55c9-5a6e-4aec-960d-16f716260073 | 8 | @Test
public void resolve() {
for (int c = 999; c > 0; c--) {
for (int b = 1000 - c; b > 0; b--) {
int a = 1000 - b - c;
if (c > b && b > a && a > 0 && b > 0 && c > 0) {
if ((a * a + b * b) == c * c) {
print(a, b, c, a * b * c);
}
}
}
}
} |
9cb8f34c-f36f-496c-b27b-92af551db9f1 | 0 | public void setAge(int age) {
this.age = age;
} |
d25e3caa-bc17-4a87-8af5-f802c40cfb96 | 4 | private String calcularTam(Double tam)
{
int cont = 2;
while(cont != 0 & tam >= 1024)
{
cont--;
tam = tam / 1024;
}
DecimalFormat df = new DecimalFormat("#.##");//Redondear
if(cont==2)
return df.format(tam) + " Byt... |
f63b56e5-ce2d-4a34-a145-fa80b4845684 | 0 | public void setConnectionInfo(ConnectionInfo connectionInfo) {
this.connectionInfo = connectionInfo;
} |
ec7cf3d8-87e7-47c7-8782-7a1e50538393 | 6 | public static void newSkin(String... strings) {
if (strings.length != 4) {
throw new IllegalArgumentException();
}
if ((strings != null) && (model != null)) {
Skin newSkin = model.newSkin(strings[0], strings[1], strings[2], strings[3] == null ? null : Paths.get(strings[3... |
e8eda169-1b27-418a-8e12-99f7a4e8d4ca | 0 | public String getTableFieldString() {
return tableFieldString;
} |
6fc98ca3-e256-4740-a381-03827e3d24ef | 8 | protected void doPrintHeader() {
if (m_Header.classAttribute().isNominal()) {
if (m_OutputDistribution) {
append("inst#" + m_Delimiter + "actual" + m_Delimiter + "predicted" + m_Delimiter + "error" + m_Delimiter + "distribution");
for (int i = 1; i < m_Header.classAttribute().numValues(); i++)
append(m_D... |
f62b8557-0880-4402-bca5-842f8e85d703 | 3 | public void joined(ViewProxy proxy, String name) {
int id;
if (names[PLAYER_ONE - 1] == null) {
names[PLAYER_ONE - 1] = name;
id = PLAYER_ONE;
}
else {
names[PLAYER_TWO - 1] = name;
id = PLAYER_TWO;
//Tell player 2 about player 1
modelListeners.get(id-1).playerInfo(PLAYER_ONE, names[PL... |
d38f3ce4-1843-481e-9924-ad0a59114eec | 3 | public void integrityTime() {
if(this.getHour() == 24) {
this.setHour(0);
}
if(this.getMinutes() == 60) {
this.setMinutes(0);
this.setHour(this.getHour()+1);
}
if(this.getSeconds() == 60) {
this.setSeconds(0);
this.setMinutes(this.getMinutes()+1);
}
} |
1ae3dfb1-eeec-42f0-9492-84ff6f30b7d3 | 6 | private void restrictDepamandsFromSourceToTargetNodes() throws IloException {
Demand demand;
Node node;
IloLinearNumExpr flow;
for (int i = 0; i < nodes.length; i++) {
node = nodes[i];
for (int k = 0; k < demands.length; k++) {
flow = cplex.linearNumExpr();
// soma custos saindo do vertice
fo... |
50157a80-b70d-4a68-bb2c-04ba98b38e61 | 9 | private static Listing parseListing(StringBuilder l) {
html2xhtml(l);
// System.out.println(l);
Listing listing = new Listing();
DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
try {
// Using factory get an instance of document builder
DocumentBuilder db = dbf.newDocumentBuilder()... |
2eb86bcc-f67f-46f0-94a3-295467a7d411 | 6 | public static String compression(String s) {
if(s == null || s.length() <= 2)
return s;
char start = s.charAt(0);
int count = 1;
StringBuilder result = new StringBuilder();
for(int i=1; i<s.length() ;i++) {
char c = s.charAt(i);
if( c == start )
count++;
else {
result.append(start + "" +... |
edfd295b-d5be-4192-9d30-912ab948cb93 | 7 | public P_BulkMakeTab(){
this.setLayout(new BorderLayout());
topPane = new JPanel();
keyLabel = new JLabel("Key");
keyTxtFld = new JTextField(10);
keyLabel = new JLabel("Enter key and tick checkbox to print just one card");
singleCardCB = new JCheckBox();
topPane.add(keyLabel);
to... |
844725a5-3ae5-43d1-871f-3f7bfc154f42 | 2 | private static int findDecBack(int[] A, int index){
for(int i=index-1;i>0;i--){
if(A[i] <= A[i-1]){
return index-i+1;
}
}
return index+1;
} |
a4cb56c3-20c7-4887-95c2-59918df6afbe | 6 | private Char(BufferedImage charImage){
//kijken hoe breed een char is
int charWidth = charImage.getWidth() - 1;//standaardlengte, voor spatie en onbekende letters
for(int x = 0; x < charImage.getWidth(); x++){
boolean rowIsEmpty = false;
for(int y = 0; y < charImage.getHeight(); y++){
if(char... |
bdb9d1e5-6d16-4fa9-b6a1-fb96bdbe4b5d | 3 | public void suffixTreeRec(ArrayList<String> SuffixList,TreeNode currentNode,int textSize)
{
ArrayList<ArrayList<String>> currentGroupList = makeGroup(SuffixList);
//old
//for(int i=0;i<currentGroupList.size();i++)
//{
//new
while(currentGroupList.size()>0)
{
ArrayList<Strin... |
22f879e7-b9a6-4cca-ac92-4c17bdffd366 | 5 | private static void loadContributors() {
if(Contributor.contributors == null) {
Contributor.contributors = new HashMap<String, Contributor>();
SettingsProcessor processor = new SettingsProcessor(Contributor.contributors);
try {
Settings.getInstance().processNodes("/c:settings/c:contributors/c:contrib... |
1c3d0091-4eb7-4a85-bd30-85a4b0c7782e | 2 | boolean first(TK [] set) {
int k = 0;
while(set[k] != TK.none && set[k] != tok.kind) {
k++;
}
return set[k] != TK.none;
} |
f4227f66-22f3-4985-a7b8-fd3192df2e6a | 0 | public int getR() {
return this.r;
} |
8f8a4bff-4988-401d-b326-14c2a3fffbdd | 8 | public final void testReadPropertyDestinationIntIntIntInt() throws KNXException,
InterruptedException
{
try {
mc.readProperty(dco, -1, 2, 1, 1);
fail("invalid arg");
}
catch (final KNXIllegalArgumentException e) {}
try {
mc.readProperty(dco, 256, 2, 1, 1);
fail("invalid arg");
}
catch (final ... |
e88d1feb-a4ca-4353-b40f-dcdab38ddff0 | 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... |
6a826151-550e-4e2c-945d-6346ac3eef6f | 5 | public static double logGammaFunction(double x) {
double xcopy = x;
double fg = 0.0D;
double first = x + lgfGamma + 0.5;
double second = lgfCoeff[0];
if (x >= 0.0) {
first -= (x + 0.5) * Math.log(first);
for (int i = 1; i <= lgfN; i++)
second += lgfCoeff[i] / ++xcopy;
fg = Math.log(Math.sqrt(2.0... |
60b7437b-ab44-4022-80cc-6116d2e3fff9 | 8 | public void draw() {
if (context != null) {
double width;
if(isPlacedOnLeftOrRight()){
width = this.leftOrRightWidth;
}else{
width = this.topOrBottomWidth;
}
Rectangle2D legendArea = new Rectang... |
4f2e98fe-de8b-49ed-aaab-37ebc26c62a8 | 5 | protected Node find(E e)
{
if (isEmpty())
return null;
Node u = root;
while (u.key != e && comparator.compare(e, u.key) != 0)
{
if (comparator.compare(e, u.key) < 0)
u = u.left;
else u = u.right;
if (u == null) retur... |
88c3b2e6-61a8-4b62-b363-7459c4059109 | 8 | public String toString(Rarity r) throws IOException {
String name;
switch(r) {
case BASIC: name = "basic";
case FINE: name = "fine";
case MASTERWORK: name = "masterwork";
case RARE: name = "rare";
case EXOTIC: name = "exotic";
case ASCENDED: name = "ascended";
case LEGENDARY: name = "legendary"... |
b9b14ffe-cf9a-455e-af30-c82f1eadd07e | 9 | public static void useStemmer(Stemmer stemmer, String[] options)
throws Exception {
Reader reader;
StringBuffer input;
Writer output;
String tmpStr;
boolean lowerCase;
// help?
if (Utils.getFlag('h', options)) {
System.out.println(makeOp... |
6b476731-d1e7-4626-8ab9-78dd54683f8b | 4 | public void addAttendantToCourse(int courseId, int studentId) {
if(!isValidId(courseId) || !isValidId(studentId)) {
return;
}
Student student = studentDao.getStudent(studentId);
Course course = courseDao.getCourse(courseId);
if(student != null && course != null) {
course.getAttendants().add(stud... |
da0a8b5f-5af7-40bd-835a-429691e6dd64 | 6 | public void createDatabase(File databaseFile, File sqliteStatements) throws SQLException {
databaseFile.delete();
parseSqlite(sqliteStatements);
Connection connection = null;
Statement stmt = null;
ResultSet rs = null;
int result;
try {
String... |
aa9690e2-f4cd-4807-b449-0895f3abae3d | 4 | public void actionPerformed(ActionEvent event) {
double a = Double.parseDouble( txtA.getText());
double b = Double.parseDouble( txtB.getText());
double c = 0;
String op = (String) ops.getSelectedItem();
if (op.equalsIgnoreCase("add"))
c = a + b... |
cbdc8429-fdc6-457f-8942-96334da0434f | 2 | public static void initialize() {
Interperet.corner = fenrir.getCorner();
Interperet.setFirstPick();
System.out.println(Interperet.corner);
for (int i = Calculate.lookAhead - 1; i >= 0; i--) {
if (i < Calculate.lookAhead - 1 ) {
Calculate.scenarios[i] = new Gr... |
23bbd231-1f57-49eb-b80f-66885ddbb0da | 6 | public void update(float gravity) {
currentAction.update();
currentAnimation.update();
velocityY += gravity;
if (velocityY < -20) velocityY = -20;
else if (velocityY > 20) velocityY = 20;
if (velocityX > 8) velocityX = 8;
else if (velocityX < -8) velocityX = -8... |
d244cd64-083b-471c-8281-65d49f15f1be | 1 | public void testMultipliedBy_int() {
Weeks test = Weeks.weeks(2);
assertEquals(6, test.multipliedBy(3).getWeeks());
assertEquals(2, test.getWeeks());
assertEquals(-6, test.multipliedBy(-3).getWeeks());
assertSame(test, test.multipliedBy(1));
Weeks halfMax = Weeks... |
a5a8161c-14d6-4464-a071-32683fb46bb0 | 0 | public void setBlogCreatedDate(Date blogCreatedDate) {
this.blogCreatedDate = blogCreatedDate;
} |
8e5d0311-3e5e-4976-bad2-e185d43974ee | 4 | public MetroGraph() throws DAOException {
DAOFactory factory = DAOFactory.getInstance();
DaoStation daoStation = factory.getDaoStation();
DaoMetroGraph daoMetroGraph = factory.getDaoMetroGraph();
vertices = new ArrayList<Vertex>();
// 1. Créer des objets Vertex sans Edge
List<Station> allStati... |
5ed1cb52-540c-4332-ac61-a3beb246481c | 4 | public static void main(String[] args) {
String startJobId = "job_201301281455_0001";
String hostname = "master";
int iterateNum = 192;
//String hostname = "m105";
//int iterateNum = 1;
//String jobDir = "/home/xulijie/MR-MEM/BigExperiments/";
String jobDir = "/home/xulijie/MR-MEM/SampleExperiments/";
... |
4afce024-3979-4031-853a-9d22d7083a9c | 9 | private void begin() {
geraCrivo();
int n = Integer.parseInt(readLn());
while (n != 0) {
if (n == 1) {
System.out.println("1 = 1");
} else if (n == -1) {
System.out.println("-1 = -1");
} else {
StringBuffer out = new StringBuffer();
out.append(n);
out.append(" = ");
if (n < 0) {
... |
02c9667e-946b-4d76-acbf-d136db5437da | 9 | public MoveResult resolveMove(StrategyBoard gameBoard, PlayerColor currentTurn,
PieceType pieceMoving, Location fromLocation, Location toLocation)
{
final MoveResult firstResult;
final Piece attacker = gameBoard.getPieceAt(fromLocation);
final Piece defender = gameBoard.getPieceAt(toLocation);
final MoveRe... |
46d78c43-45f9-4640-aca4-6908950bba47 | 2 | protected void threadStarted() {
// wait for the SoundManager constructor to finish
synchronized (this) {
try {
wait();
}
catch (InterruptedException ex) { }
}
// use a short, 100ms (1/10th sec) buffer for filters that
// chang... |
4086198e-b557-452f-a358-efb96326a68d | 9 | public void drawRotated(Bitmap bitmap, int xOffs, int yOffs, int xo, int yo, int w, int h, int rotation) {
final double radians = Math.toRadians(rotation);
final double cos = Math.cos(radians);
final double sin = Math.sin(radians);
for(int y = 0; y < w; y++){
int yPix = y + y... |
0c92d701-b979-4b77-a9bb-c4580e62b3ad | 9 | private ModNode createChildNode(Element eTable) {
ModNode tableNode = new ModNode("", "");
String tempName = "";
String eName = "";
NodeList nNodeList = eTable.getChildNodes();
for (int j = 0; j < nNodeList.getLength(); j++) {
Node nNode = nNodeList.item(j);
if (nNode.getNodeType() == Node.ELEMENT_NODE)... |
9d086380-2fae-47b4-91e9-08cc87dd11eb | 7 | public void draw(Bitmap bitmap, int xo, int yo) {
for (int y = 0; y < bitmap.height; y++) {
int yy = y + yo;
if (yy < 0 || yy >= this.height)
continue;
for (int x = 0; x < bitmap.width; x++) {
int xx = x + xo;
if (xx < 0 || xx >= this.width)
continue;
int color = bitmap.pixels[x + y * bi... |
1cacf1e4-cdc8-4641-9afe-c892e1579d50 | 7 | public int node_alloc(int size) {
int idx;
int pidx;
if (size <= 0) {
System.err.println("node alloc: wrong size");
return 0;
}
pidx = FREE_NODE;
for (idx = free_head.next_idx; idx != FREE_NODE; idx = trie_buf[idx].free.next_idx) {
if (trie_buf[idx].free.size >= size) {
break;
}
pidx =... |
56e9d031-fe82-45b9-97c5-a78b50c3a636 | 8 | @Override
public void createFromXML(NodeList attributes) {
Node node = attributes.item(0);
while(node != null) {
GameActor a = null;
float X = 0;
float Y = 0;
if(node.getNodeType() == Node.ELEMENT_NODE && node.getNodeName().equalsIgnoreCase("actor")) {... |
d4fa550b-4d85-4098-aa75-924b115474df | 1 | private boolean jj_2_66(int xla) {
jj_la = xla; jj_lastpos = jj_scanpos = token;
try { return !jj_3_66(); }
catch(LookaheadSuccess ls) { return true; }
finally { jj_save(65, xla); }
} |
16f34f27-50a4-4b68-bcc2-864b4c80eba3 | 5 | public PhoneNumber(String phoneNum) {
phoneNum = phoneNum.replaceAll("-|\\s|\\.|\\(|\\)", "");
boolean isValid = true;
if (phoneNum.length() != 10)
isValid = false;
for (int i = 0; isValid && i < 10; i++)
if (!Character.isDigit(phoneNum.charAt(i)))
isValid = false;
if (isValid) {
areaCode = pho... |
e30badc5-9def-4a21-a02d-330077c71258 | 4 | public List<Entity> getEntitiesInRange(double x, double y, double radius) {
ArrayList<Entity> list = new ArrayList<Entity>();
for(Entity entity : entities) {
if(entity != null && !entity.isDead && entity.getDistance(x, y) <= radius) {
list.add(entity);
}
}
return list;
} |
4c760eec-ebfd-4724-b797-39d697637c15 | 3 | public void outputAnnotationIndex(PrintWriter writer)
{
for (String ann : annotationIndex.keySet())
{
writer.print(ann);
writer.print(": ");
Set<String> classes = annotationIndex.get(ann);
Iterator<String> it = classes.iterator();
while (it.hasNext())
... |
0dd3e969-6102-4b4b-81b3-fa6b7dddfa56 | 9 | public static int[][] toPrintable(int[] buildings) {
// 1 row for bottom 2 cols for walls and 2 for heights
int[][] res = new int[max(buildings)][buildings.length + 4];
for (int i = 0; i < res.length; i++) {
Arrays.fill(res[i], BLANK);
}
// Side walls
for (int... |
11be2282-9eeb-4ee3-a23b-534134114ae6 | 8 | public static Blob getMstxAdsImageByGpid(int gpid) {
Blob result = null;
Connection con = DBUtil.getConnection();
PreparedStatement pstmt = null;
ResultSet rs = null;
try {
pstmt = con.prepareStatement("select gdata from mstx_ads_image where gpid = ?;");
pstmt.setInt(1, gpid);
rs = pstmt.executeQuery... |
346f4a29-4e26-49fa-b7dd-2382ab9b69e6 | 3 | @Override
public NettyHttpResponse error(Throwable error) {
if (error instanceof TooLongFrameException) {
response.setStatus(HttpResponseStatus.REQUEST_ENTITY_TOO_LARGE);
} else {
response.setStatus(HttpResponseStatus.INTERNAL_SERVER_ERROR);
}
// String message... |
eaf00a51-fa6a-4679-9ec8-bd9656dcde16 | 6 | static Object redirect(Object proxy, InvocationHandler handler, Method m,
Object... args) throws Throwable {
try {
return handler.invoke(proxy, m, args);
} catch (final Throwable t) {
if (t == null)
throw new Exception(
"An exception was here, but apparently it decided to g... |
f45bc2a9-df08-49e9-8b0e-899685783c74 | 8 | public void actionPerformed(ActionEvent evt) {
viewer.moveFocusToDesktop();
if (evt.getSource() == disconnectButton) {
viewer.disconnect();
} else if (evt.getSource() == optionsButton) {
viewer.options.setVisible(!viewer.options.isVisible());
} else if (evt.getSource() == recordButton) {
viewer.rec... |
e0e493d6-e1aa-42cb-9100-8204bdcedac4 | 6 | public static final Color checkColour(int red, int green, int blue)
{
if (red < 0)
red = 0;
else if (red > 255)
red = 255;
if (green < 0)
green = 0;
else if (green > 255)
green = 255;
if (blue < 0)
blue = 0;
else if (blue > 255)
blue = 255;
return new Colo... |
38ed3786-d68d-4dea-9216-f6fb02a16392 | 8 | static Line[] mergeSegments(Line[] segsOrig) {
int n = segsOrig.length;
Line[] segs = new Line[n];
for (int i = 0; i < n; i++) {
segs[i] = segsOrig[i].a.compareTo(segsOrig[i].b) < 0
? segsOrig[i]
: new Line(segsOrig[i].b, segsOrig[i].a);
... |
bf7c87a0-3dba-44a7-acd1-1683dae0ec63 | 9 | public State read_state() {
State state = new State();
int i, j;
for (i = 0, j = 0; i < 3; i++, j += 7) {
WaveformGenerator wave = voice[i].wave;
EnvelopeGenerator envelope = voice[i].envelope;
state.sid_register[j + 0] = (char) (wave.freq & 0xff);
state.sid_register[j + 1] = (char) (wave.freq >> 8);... |
82c9ae5d-118e-4a41-aaa7-3863d4ce6788 | 6 | @Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
BeanInfo other = (BeanInfo) obj;
if (type == null) {
if (other.type != null)
return false;
} else if (!type.equals(other.type))
retur... |
347e50c2-aa7f-4bc0-b2eb-532f66d04d56 | 3 | @Override
public void buy(Command cmd)
{
cmd.execute();
if(Storage.getInstance().getRevenue() < 10000.0)
{
restaurant.setState(restaurant.getBadstate());
}else if(Storage.getInstance().getRevenue() >= 10000.0 && Storage.getInstance().getRevenue() < 20000.0)
{
restaurant.setState(restaurant.getNormalst... |
8c11298f-eabd-4f8c-899e-e8374b596fad | 4 | public int indexOf(Object inputData) {
ListNode currentNode = this.firstNode;
int position = 0;
boolean found = false;
for (; ; position++) {
if (currentNode == null) {
break;
}
if (inputData.equals(currentNode.getData())) {
... |
e279e9fd-fca5-45ab-a428-9983f15e97b6 | 9 | @Override
public void nativeKeyReleased(NativeKeyEvent arg0) {
// TODO Auto-generated method stub
if (lastkey==arg0.getKeyCode()){
ignore=false;
} else {
}
//ctrl+v (when keeping ctrl pressed nothing gets typed)
if (arg0.getKeyCode()==KeyEvent.VK_CONTROL && this.readyToType){
try {
Str... |
b12ca814-8b8b-40ce-a6ef-578e8f87e790 | 1 | public void updateImage()
{
delayCounter++;
if(delayCounter>delay)
{
delayCounter=0;
frameNumber++;//updates frame to next frame
frameNumber%=totalFrame;// if surpass 3rd frame, back to frameNumber 0
//sets image to specific frameNumber by multiplying it with 500, aka width of the image
this.setImage(f... |
a2697ab9-9c2b-4a58-8c93-7ec0ae67e5e4 | 5 | public PushedNotifications sendPayload(Payload payload, String[] deviceTokens)
throws CommunicationException, KeystoreException {
PushedNotifications notifications = new PushedNotifications();
if (payload == null) {
return notifications;
}
try {
if (!isConnected) {
initialize... |
771b1ac8-57cc-4281-be54-fb674b68dc4e | 4 | public static void generateCornerHeuristics() {
// Make a cube and initialize it with a solved cube state
Cube cube = new Cube(Cube.GOAL.toCharArray());
// Make a new Queue to perform BFS
Queue<CubeNode> q = new LinkedList<CubeNode>();
// Put the solved/initial state of the corners on the queue
q.add(new ... |
8545e14e-97e4-4a23-960f-614c585c4c7d | 5 | public void merge(LeftistTreeNode root, LeftistTreeNode newNode) {
// Considering the tree.element with largest value on the top
if (root.parent == null && root.value.compareTo(newNode.value) < 0) { // invert here to change to small priority on top
if (newNode.right == null) {
... |
97e1823c-1052-4360-9498-ea52aa3c1678 | 1 | private static void displayEmployees(ResultSet rs)throws SQLException{
StringBuffer bf = new StringBuffer();
while (rs.next()){
bf.append(rs.getString("name")+" ");
bf.append(rs.getString("username")+" ");
bf.append(rs.getString("pass")+" ");
bf.append(rs.getDate("dob")+" ");
bf.append(rs.getStrin... |
05d10d9a-7f73-41fe-a6ee-8bd67c518342 | 7 | public static void write(Writer output, AuTerm term) throws IOException {
if(term.getAnnotation() != null) {
output.write('@');
write(output, term.getAnnotation());
}
if(term instanceof AuMeta) {
output.write('M');
}else if(term instanceof AuVar) {
AuVar var = (AuVar)term;
output.write('V');
... |
93f7653a-74f1-4652-a496-9c5e277d98bc | 2 | public CommonResponse(final Boolean success, final String errorMessage) {
if (success != null) {
this.success = success;
}
if (errorMessage != null) {
this.errorMessage = errorMessage;
}
} |
46d1804a-44a1-418f-a89e-b30c67b86ea8 | 0 | public int len() {
return MPI_string.length;
} |
b93666ff-b549-43fb-a150-94f7cbd528fd | 2 | public String getGeneId() {
// Try ID
String geneId = get("id");
if (geneId != null) return geneId;
// Try 'locus'...
geneId = get("locus_tag");
if (geneId != null) return geneId;
// // Try 'gene'...
// geneId = get("protein_id");
// if (geneId != null) return geneId;
//
// // Try 'db_xref'.... |
69421685-23ec-4e00-8ba2-468368290830 | 1 | public static boolean test(String falseString, String trueString) throws IOException{
InStream sr = new StringInStream(falseString);
OutStream sw = new StringOutStream();
FormatSettings formatSettings = new FormatSettings();
FormatOld.format(sr, sw, formatSettings);
if(trueStr... |
19ec807b-7d98-4c93-aef5-6b817dd75d95 | 9 | private int jjMoveStringLiteralDfa0_0()
{
switch(curChar)
{
case 35:
return jjStopAtPos(0, 13);
case 43:
return jjStopAtPos(0, 6);
case 44:
return jjStopAtPos(0, 9);
case 45:
return jjStopAtPos(0, 5);
case 46:
return jjStopAtPos(0, 7);
... |
ed4319d3-1e55-4489-b20b-3281c3aed5cf | 6 | public static int[] getLongestIncreasingSubsequence(int[] sequence) {
int[] start = new int[sequence.length + 1];
int[] previous = new int[sequence.length];
int length = 0;
int low;
int mid;
int high;
int newLength;
for(int i = 0; i < sequence.length; i++) {
low = 1;
high = length;
while(low ... |
cf2fc681-bad6-49e6-aaa0-3f3a50447255 | 1 | @Override
public void destroy() {
for(ActorSlot as : actors) {
Application.get().getEventManager().queueEvent(new ActorDestroyedEvent(as.actor));
}
} |
ae7ddebe-cf4d-4d09-a078-a583d573c06f | 3 | @SuppressWarnings("rawtypes")
public void checkCollisions()
{
Rectangle r3 = prometheus.getBounds();
/*for (int j = 0; j<aliens.size(); j++)
{
Alien a = (Alien) aliens.get(j);
Rectangle r2 = a.getBounds();
if (r3.intersects(r2))
{
... |
ea4b93a7-c113-4659-bb88-353453cefa0a | 4 | private boolean validElement(Element element, Position position) {
if (element == null || position == null)
return false;
for (Map.Entry<Position, Square> entry : squares.entrySet())
if (entry.getValue().getElements().contains(element))
return false;
return getSquare(position).validElement(element);
... |
2b977f51-524a-42eb-b3c4-0d2db03fff49 | 6 | void constructNearestGraph() {
_Doc di, dj;
double similarity;
MyPriorityQueue<_RankItem> kUL = new MyPriorityQueue<_RankItem>(m_GFObj.m_k);
MyPriorityQueue<_RankItem> kUU = new MyPriorityQueue<_RankItem>(m_GFObj.m_kPrime);
_Node node;
for (int i = m_start; i < m_end; i++) {
di = m_GFObj.getTestDoc... |
f9fa549a-1512-4fd0-b37e-4642a8facbd3 | 4 | public void load(File f) throws IOException {
DOMParser parser = new DOMParser();
if (f == null) {
System.out.println("File is null!");
}
try {
FileInputStream fis = new FileInputStream(f);
InputSource s = new InputSource(fis);
parser.parse(s);
} catch (SAXException e) {
// throw new IOException... |
5f3f5bd9-0498-4b8c-af6b-8986c28c166d | 8 | public final GramaticaAst.expr_arith_return expr_arith() throws RecognitionException {
GramaticaAst.expr_arith_return retval = new GramaticaAst.expr_arith_return();
retval.start = input.LT(1);
Object root_0 = null;
Token MULT107=null;
Token DIV108=null;
Token MOD109=nu... |
98c5a98b-58b3-4d18-b29f-5cbbd007b632 | 2 | public static void main(String [] args ) {
//Start time
double startTime = System.currentTimeMillis();
long i = 0;
long sum = 0;
while (i < 2000000){
if( isPrime(i) ) {
sum += i;
}
i++;
}
System.out.println(sum);
//End time
double endTime = System.currentTimeMillis();
... |
84ac1ca8-d635-49c9-9394-cd36ff31cd40 | 6 | public static boolean valueClashesWithSkolemP(Skolem skolem, Stella_Object value) {
{ Surrogate type = skolem.skolemType;
if (type == null) {
return (false);
}
else if (!(((((QueryIterator)(Logic.$QUERYITERATOR$.get())) != null) &&
(((QueryIterator)(Logic.$QUERYITERATOR$.get()))... |
3438e08b-c3aa-404c-b113-f498af3ecfd1 | 5 | public static Map<term_t, Variable> namevarsToMap(Term nvs) {
try {
Map<term_t, Variable> vars_to_Vars = new HashMap<term_t, Variable>();
// while (nvs.isListPair() && nvs.arg(1).hasFunctor("=", 2)) {
while (nvs.arity() == 2 && (nvs.name().equals(JPL.LIST_PAIR_MODERN) || nvs.name().equals(JPL.LIST_PAIR_TRADI... |
97cb7c64-7fd3-4bc1-aac2-f03ec26c6f49 | 3 | public static int moreThanHalfTwo(int[] array){
int element = array[0];
int count = 1;
for(int i = 1;i<array.length;i++){
if(count == 0){
element = array[i];
}
if(array[i] == element){
count ++;
}else{
count --;
}
}
return element;
} |
1402bf6b-2a1c-4e16-8b2e-49669bc71213 | 1 | private static byte[] readFile(String file) throws IOException {
// Open file
RandomAccessFile f = new RandomAccessFile(new File(file), "r");
try {
// Get and check length
long longlength = f.length();
int length = (int) longlength;
if (length != l... |
f27e98cc-79d4-4189-8ec0-8d207d0fdca5 | 7 | private void drawPieces(Graphics2D g2d) {
drawBoard.calculateTerritory();
for (int i = 0; i < 9; i++) {
for (int j = 0; j < 9; j++) {
g2d.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 1.0f));
if (drawBoard.getContents(i, j) != Intersection.Piece.EMPTY) {
if (drawBoard.getContents(... |
75abc00b-2f21-4e58-baef-a1b2d003e7eb | 2 | private static synchronized void ckpl() {
if(enabled) {
if(player == null) {
player = new Player();
player.start();
}
} else {
ncl.clear();
}
} |
8ea8d539-513c-4108-9476-394109318b24 | 6 | public boolean isHitBrick(Brick brick) {
// TODO: change to event driven
if (this.getRect().intersects(brick.getRect()) && brick.getLive() == true) {// getRect创建矩形,用于判断碰撞,intersects方法用于判断矩形是否相交见api与tank1.6
if (y - YSPEED <= brick.getTop())
moveToDown = false;// 判断球与板碰撞以后改变球的运动方向,向上
else if (y + YSPEED >= ... |
dcc1a789-acce-4793-94d6-9c57fbce256c | 0 | public void setConcepto(String concepto) {
this.concepto = concepto;
} |
237a5dab-fafc-4f54-9f1e-83a04f22bfb9 | 3 | public boolean isWASD(int keyCode)
{
return keyCode == KeyEvent.VK_W || keyCode == KeyEvent.VK_A || keyCode == KeyEvent.VK_S || keyCode == KeyEvent.VK_D;
} |
eba0f1bd-6dad-4e70-95ef-5df96c378baa | 8 | public synchronized void change(T t, K k)
{
TreeSet<K> tKs=map1.get(t);
while((tKs!=null)&&(tKs.size()>=maxKsInMap1))
remove(t,tKs.first());
tKs=map1.get(t);
if(tKs==null)
{
tKs=new TreeSet<K>(comparator);
map1.put(t, tKs);
}
TreeSet<T> kTs=map2.get(k);
while((kTs!=null)&&(kTs.size()>=maxTsInM... |
f8551cf1-c76d-4e7e-ba4e-93708841a724 | 3 | public static void setupOpenGL() {
try {
if (FULLSCREEN && Display.getDisplayMode().isFullscreenCapable()) {
Display.setFullscreen(true);
Display.setVSyncEnabled(true);
}
else {
Dimension screenSize = Toolkit.getDefaultToolkit()... |
e0f75bcb-0722-4212-9fea-8cd2bb2e5022 | 5 | public static void main(String[] args) throws Exception{
long[] time;
time = new long[10];
Thread.currentThread().setPriority(Thread.MAX_PRIORITY);
int THREAD_COUNT = 10000;
Thread threads[];
threads = new Thread[THREAD_COUNT];
Calculate cal... |
6a3f129e-d5f7-46e9-8fec-07038d0f912b | 8 | private void unpaid_report() {
// todo: this function generates the unpaid report for the manager.
// I would format like this:
/*
* AdID: Name: Phone: Title: Cost: Content: width:20 Width:20 width:12
* width:30 width: 10 width: 200
*/
try {
String column_headers = "AdID:\t" + "Name:\t" + "Phone:\t... |
496b53d5-3bc7-494d-8167-e4d6a6152bee | 6 | public final void createAlliance(final MapleClient c, final String name) {
if (allianceid != 0) {
c.getPlayer().dropMessage(1, "You are already in an Alliance!");
return;
}
if (checkAllianceName(name)) {
try {
if (name.equals("") || id <= 0) {
return;
}
Connection con = DatabaseConnection.... |
b0f5032e-6dd3-4efe-acbc-8d2f934372a7 | 1 | public static byte[] rstr(String hex) {
int length = hex.length();
byte[] bHex = new byte[length/2];
String temp = null;
int t = 0;
for (int i=0; i<length; i++) {
temp = "" + hex.charAt(i) + hex.charAt(++i);
bHex[t++] = (byte)Integer.parseInt(temp, ... |
501c86e1-a316-4305-9c68-3dd41774cbcd | 8 | public SongChangeData(final SongDataEntry voices,
@SuppressWarnings("hiding") final Main main) {
this.main = main;
this.date = stone.util.Time.date(voices.getLastModification()).split(
" ");
this.file = voices.getPath();
Debug.print("%s\n", this.file);
for (final Map.Entry<Integer, String> titleEntry :... |
d90fc41e-eead-40cf-99a0-bb15539afb03 | 7 | boolean directLinkPossibleForGeometry(int row1, int col1, int row2, int col2) {
final int rowMin = Math.min(row1, row2);
final int rowMax = Math.max(row1, row2);
final int colMin = Math.min(col1, col2);
final int colMax = Math.max(col1, col2);
final LineSegmentInt seg = new LineSegmentInt(col1, row1, col2, ro... |
2156d3ca-dc9a-4f58-bb71-3e2542846991 | 0 | public String getCarSourceUrl() {
return carSourceUrl;
} |
f5c4038c-538f-4a08-b78b-9965d29e254f | 4 | Elem(String file) {
n++;
X = new double[inputNo];
actualY= new double[outputNo];
String[] arrs = file.split(",");
for(int i=0; i<inputNo; i++)
X[i]=Double.parseDouble(arrs[i]);
for(int i=inputNo; i<outputNo+inputNo; i++)
actualY[i-inputNo]=Double.parseDouble(arrs[i]);
... |
5b096051-4a7b-4654-9038-0d45630a6e30 | 2 | public Entry (int piece, PositionRange pieceRange, Path file, PositionRange fileRange) {
if (piece < 0 | pieceRange.getLength() != fileRange.getLength()) {
throw new IllegalArgumentException();
}
if (file == null) {
throw new NullPointerException();
... |
040d3109-c5ea-4944-af9f-4c1380b8c51b | 3 | protected Image(java.awt.Image image, boolean mutable, boolean toGray, String name) {
Display.check();
// Give VM some time to cleanup every n images...
if(((++imageCreationCount) & 7) == 0){
try{
Thread.sleep(4);
}
catch(InterruptedExcepti... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.