method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
22a8657b-c2ec-4a3b-8457-775f57eb3f63 | 1 | public Constant newLong(final long value) {
key1.set(value);
Constant result = get(key1);
if (result == null) {
result = new Constant(key1);
put(result);
}
return result;
} |
21ae2e20-564c-4306-a02d-f0ac19de3047 | 2 | @Test
public void testAddByteRowsVolume() throws Exception {
Integer id = 200108;
Long start = new Date().getTime();
ByteBuffer b = ByteBuffer.allocate(1000*16);
for(int c=0;c<10*1000;c++){
log.info("c:"+ c);
for(int i=0;i<1000;i++){
b.putInt(id);
b.putLong(start);
start = s... |
89b69e54-8abb-4dbe-ad5a-7fe1bdc2631c | 6 | public static void verifyForallPropositions(Proposition proposition) {
{ Keyword testValue000 = proposition.kind;
if (testValue000 == Logic.KWD_FORALL) {
{ Proposition antecedent = ((Proposition)((proposition.arguments.theArray)[0]));
Proposition consequent = ((Proposition)((proposition.arg... |
be221d41-2b3e-453b-b4df-cb2939f00b0b | 4 | @Override
public boolean equals(Object value)
{
if (value == this)
return true;
if (!(value instanceof HashBuilder))
return false;
HashBuilder other = (HashBuilder) value;
return other.result == result && other.base == base
&& oth... |
fcc334b7-35a6-4427-abdf-112d1e414afa | 8 | public int climbStairs(int n) {
int sum = 0;
if (hash.containsKey(n)) {
return hash.get(n);
}
// using DP
if (n == 1) {
if (!hash.containsKey(n)) {
hash.put(1, 1);
}
return 1;
} else if (n == 2) {
if (!hash.containsKey(n)) {
hash.put(2, 2);
}
return 2;
}
if (n <= 0) {
if... |
92496c26-9de0-49fd-9eb5-7638bbace289 | 1 | public final void visitMethodInsn(
final int opcode,
final String owner,
final String name,
final String desc)
{
AttributesImpl attrs = new AttributesImpl();
if (opcode != Opcodes.INVOKEDYNAMIC) {
attrs.addAttribute("", "owner", "owner", "", owner);
... |
b9a4bab6-fc9f-450a-a4f7-4a99e2167d0b | 1 | public void setfocusctl(boolean focusctl) {
if (this.focusctl = focusctl) {
findfocus();
setcanfocus(true);
}
} |
847d0c44-90a2-4890-8ce0-4c397139d9eb | 2 | public final void yaw(double angle) {
if (ZAXIS_ANGLE == -angle) {
ZAXIS_ANGLE = angle;
ZAXIS_TURN.entry[0][1] = -ZAXIS_TURN.entry[0][1];
ZAXIS_TURN.entry[1][0] = -ZAXIS_TURN.entry[1][0];
} else if (ZAXIS_ANGLE != angle) {
// Cache it!
ZAXIS_ANGLE = angle;
angle = Math.toRadians(angle);
double ... |
c794a5e7-8698-454b-8bc7-a160cc1f8f5e | 4 | public static void main(String args[]) {
try {
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
} catch (ClassNotFoundException ex) {
java.util.logging.Logger.getLogger(FrameTeste.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch ... |
ea5040ea-1674-4916-882e-ad9bac9ac001 | 6 | @Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
final SpanOrQuery that = (SpanOrQuery) o;
if (!clauses.equals(that.clauses)) return false;
if (!clauses.isEmpty() && !field.equals(that.field)) return false;
re... |
4c72c682-446c-4a09-bade-fac939c20aeb | 8 | public static int canCompleteCircuit(int[] gas, int[] cost) {
int gasSum = 0;
int costSum = 0;
for(int i=0;i<gas.length;i++) {
gasSum = gasSum + gas[i];
}
for(int i=0;i<cost.length;i++) {
costSum = costSum + cost[i];
}
if(costSum > gasSum) {
return -1;
}
... |
a194efb6-1b0a-4c8b-9594-b1155097668b | 4 | public Lamp(Block block,int type, String player){
this.block=block;
this.type=type;
this.player=player;
if(this.type==1){
this.block.setTypeId(123);
}else if(this.type==2){
this.block.setTypeId(124);
}else if(this.type==3){
BLWorld blworld=BLWorld.get(block.getWorld());
if(blworld==null){
bl... |
723ec5a9-1d8b-47d7-ad36-dc617a4632e3 | 4 | private static <T> boolean isBsonPrimitives(Class<T> clazz) {
if (PRIMITIVES.contains(clazz)) {
return true;
}
for (Class<?> primitive : PRIMITIVES) {
if (primitive.isAssignableFrom(clazz)) {
return true;
}
}
return false;
} |
abc24137-543c-4bb7-99f0-2f4c234291a5 | 4 | public Barb(int x, int y){
sx = x;
sy = y;
Random r = new Random();
spawndir = r.nextInt(4);
spawnloc = r.nextInt(8);
if(spawndir==0) by = 0;
if(spawndir==1) bx = 8;
if(spawndir==2) by = 8;
if(spawndir==3) bx = 0;
... |
0175ba57-3798-48ff-bf12-39ee9c166470 | 0 | public void remove(T entity) {
getEntityManager().remove(getEntityManager().merge(entity));
} |
d6b61543-1870-4423-8def-50ad03d8b14c | 7 | public void write(OutputStream out) throws IOException
{
PrintWriter pw = new PrintWriter(out);
String line = "HTTP/1.0 " + status + " \r\n";
pw.print(line);
if (mimeType != null)
{
line = "Content-Type: " + mimeType + "\r\n";
pw.print(line);
}
if (header != null)
{
Enumeration e = header.... |
b27ac535-d594-4e93-8d76-135b91c57dc6 | 1 | public String getName() {
if (name == null) {
name = "q" + Integer.toString(getID());
}
return name;
} |
562c53cb-53ef-4f9c-9d96-762dc1f3cb85 | 5 | public static void main(String [] args)
{
int port = 8000;
if (args.length == 0){
System.out.println("use port 8000");
} else {
try{
port = Integer.parseInt(args[0]);
System.out.println("use port " + port);
} catch (NumberFo... |
a99ff802-c78d-4a15-976e-252d79f27cf3 | 0 | public void setElementsUnbalanced(String[] elementsUnbalanced) {
this.ELEMENTS_UNBALANCED = elementsUnbalanced;
} |
3e54d63c-7afe-4841-9e19-ac9ae0959acc | 2 | public double stdev() {
if (nround == 0)
return nfruits;
double avg = average();
int sum = 0;
for (int i = 0; i < nround; i++) {
double diff = avg - score(i);
sum += Math.pow(diff, 2.0);
}
return Math.pow((sum/nround), 0.5);
} |
3fe0d2a2-0d4a-4ddd-b3f2-7f2cc81bccbd | 3 | public void saveFireListFile()
{
if (fireListCfg == null || fireListFile == null)
{
return;
}
try
{
getFireListFile().save(fireListFile);
}
catch (IOException ex)
{
Arctica.log.severe("Could not save data to " + fireListFile.getName());
... |
d95a53eb-efb2-4f2a-9e79-0cacbbb99233 | 1 | public void addBuffers(GameAction action) {
if (!buffers.contains(action)) {
this.buffers.add(action);
}
} |
65f59de6-b185-4352-a412-f4b4c5f83377 | 0 | public int GetNumberOfBussesCreated()
{
return bussesCreated;
} |
58ff9b00-621e-470e-b0cf-15f50a35e7e2 | 4 | private Vertex generateMst(ArrayList<Dist> dists, int nodesSize) {
Vertex neighbours[] = new Vertex[nodesSize];
for (short i = 0; i < nodesSize; i++)
neighbours[i] = new Vertex(i);
int vertexCount = 0;
for (Dist dist : dists) {
if (vertexCount == nodesSize - 1)
break;
Vertex a = neighbours[dist.... |
858212d3-f588-4bd7-b5bc-a96126656860 | 4 | public String getPlayer1File() {
boolean test = false;
if (test || m_test) {
System.out.println("FileManager :: getPlayer2File() BEGIN");
}
if (test || m_test) {
System.out.println("FileManager :: getPlayer2File() END");
}
return PLAYER1_FILE;
} |
096b6abd-937f-4af8-bde6-557c4c7ca0d9 | 6 | @Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (!(obj instanceof WordResult))
return false;
WordResult other = (WordResult) obj;
if (number == null) {
if (other.number != null)
return false;
} else if (!number.equals(other.numbe... |
7198aacc-d24d-4816-b3fa-6a38ebf2570d | 7 | @Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
EmailAddress that = (EmailAddress) o;
if (id != null ? !id.equals(that.id) : that.id != null) return false;
if (label != null ? !label.equals(t... |
7e5e6e75-b554-4b0e-b369-774988cc05e5 | 1 | @Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((map == null) ? 0 : map.hashCode());
return result;
} |
b53f3fcd-2902-4422-8910-6cace0eb8250 | 6 | public static Map mapFromDatabase(String url, String user, String password) {
Connection c = null;
Statement stmt = null;
Map imagesTags = new HashMap();
try {
/* Connect to database */
Class.forName("org.postgresql.Driver");
c = DriverManager.getCon... |
15078f40-d59f-4c61-8056-a66ee4e6f53f | 4 | private void processGridletSubmit(Sim_event ev, boolean ack)
{
try
{
// gets the Gridlet object
Gridlet gl = (Gridlet) ev.get_data();
// checks whether this Gridlet has finished or not
if (gl.isFinished())
{
String name = G... |
0adb8eff-a267-411a-8aea-2a0cde078f70 | 1 | public Item removeAfter(Node<Item> nd)
{
if (nd.next == null) // No nodes after the last node
return null;
Item item = nd.next.item;
nd.next = nd.next.next;
return item;
} |
fb52e884-c32c-492a-8db1-4b24a28d98d6 | 4 | public void mutate (double intensity) {
//Our start/end values for the set of node ids we want to mutate
int topEnd = NeuralNets.generator.nextInt(this.getTopId()) + 1;
//System.out.println("Top Node: " + topEnd);
int bottomEnd = NeuralNets.generator.nextInt(topEnd) + 1;
//System... |
d21b3e47-f6a7-4191-b9e7-872c0a52a9f7 | 6 | private Constructor<?> getGUIConstructor(Class<? extends OVComponent> c) {
for (Constructor<?> con : c.getConstructors()) {
if (con.getGenericParameterTypes().length == 1) {
if (con.getGenericParameterTypes()[0] == OVContainer.class) {
return con;
}
}
}
return null;
} |
df4e8f0c-3b1b-42e7-aeee-2b703e76cd96 | 9 | public void setTestResult(CEvalItem aitem)
{
this.testresult = CAppConsts.StatusNone;
if (aitem.resultcd.equals(this.resultcd) && this.resultcd.equals(CAppConsts.ResComplete))
{
this.testresult = CAppConsts.StatusPass;
return;
}
if (aitem.resultcd.equals(this.resultc... |
559aef18-8880-4248-84bb-b81738920fac | 8 | public String find(String word){
for(int i=0; i<word.length(); i++){
if(word.charAt(i)<'A' || word.charAt(i)>'Z') return "Dislikes";
}
for(int i=0; i<word.length()-1; i++){
if(word.charAt(i)==word.charAt(i+1)) return "Dislikes";
}
for(int i=0; i<word.lengt... |
1a8076b3-690f-4e14-b76f-a60245a215d7 | 0 | public SingleYamlDataHolder(File f) {
file = f;
} |
843aad58-9f65-430e-8594-1db432106d7b | 6 | public static void main(String[] args) {
//String arquivoTeste = "./test/AnaliseSintatica.portugol";
//String arquivoTeste = "./test/Comentarios.portugol";
String arquivoTeste;
FileReader file;
BufferedReader buffer;
if (args != null){
try {
arquivoTeste = args[0];
file = new FileReader(arq... |
64a6e19b-c5ce-4352-9c99-e118628d6974 | 7 | public Object getFromCache(String key) throws Exception {
Object obj = null;
Connection con = null;
PreparedStatement pstmt = null;
try {
con = getConnection();
pstmt = con.prepareStatement("SELECT DATA,EXPIRY_TIME_STAMP FROM DATA_CACHE WHERE KEY = ?");
int k = 1;
pstmt.setString(k++, key);
... |
3f0c90f1-1bb0-4da4-ad1b-6917eec94cd7 | 2 | public void setSelected(boolean b) {
if (b == selected)
return;
selected = b;
if (selected) {
preSelectedMovie = getMovie();
setMovie(selectedMovie);
} else {
setMovie(preSelectedMovie);
}
} |
658d4a8c-596c-41b1-9065-94a56e04bd2e | 3 | @Override
public void addLetterTile(Tile lt) {
if(lt == null)
throw new NullPointerException("Can't add null tile.");
if(letters.size()>=MAX_LETTER_TILES)
return;
if(!(lt instanceof LetterTile))
return;
letters.add(lt);
} |
0f83d8b8-4c15-45c3-bcc6-3fdc068f92c5 | 0 | public Configuration getConfiguration() {
return configuration;
} |
29a4f321-ec3c-4b11-863a-418289435d97 | 0 | public PrintUtilities(JComponent componentToBePrinted) {
this.componentToBePrinted = componentToBePrinted;
} |
7656c850-0172-46a2-8db5-f0f96daf2add | 6 | public int getMaxMaand(int jaar)
{
int maand = 1;
// Itereer de datasets
for (DataSet set: this.datasets)
{
for (Category cat: set.categories)
{
for (SubCategory scat: cat.subcategories)
{
SubCategory subcat = new SubCategory(scat.id, scat.naam, scat.datatype, sc... |
9230aba0-5237-4005-b61b-a5279c134713 | 2 | String call() {
Module module = StaticsHelper.val().getModuleByChain(this.moduleChain);
if (null == module) {
throw new NullModuleException();
}
Command command = module.getCommand(this.commandName);
if (null == command) {
throw new NullCommandException();
}
return command.cmd(this.getConfigNa... |
7d11dc2d-341a-495f-a1e4-8573155ca419 | 1 | public static void fillEmployeeTable (ManageEmployeePage manageEmp){
String realname = null;
String username=null;
clearTable(manageEmp);
ArrayList<String> names=new ArrayList<String>();
names= DatabaseProcess.getEmployeeNames();
int j=0;
int i=0;
//manageEmp.getTable().
for(;i<names.size();i++,j++){
... |
47e4f313-bb14-442c-8382-ef5cc08b5f24 | 1 | public void testSetMilliOfDay_int2() {
MutableDateTime test = new MutableDateTime(2002, 6, 9, 5, 6, 7, 8);
try {
test.setMillisOfDay(24 * 60 * 60 * 1000);
fail();
} catch (IllegalArgumentException ex) {}
assertEquals("2002-06-09T05:06:07.008+01:00", test.toString(... |
01fbcd81-0f05-4ba7-aea3-08fdc3bc13aa | 6 | public static BInteger fromBencodedValue(String bencodedValue, AtomicInteger index) throws BParsingException {
if (!bencodedValue.startsWith(String.valueOf(START_SYMBOL), index.get())) {
throw new BParsingException("Invalid bencoded integer");
}
final int startIndex = index.increment... |
e0b616a6-22b6-4001-94f2-ebc6daa9c759 | 7 | private double checkTransform() {
if(getLoc().nextTile != null) {
if(getLoc().getCoordinates().x - getLoc().nextTile.getCoordinates().x > 0)
return (-Math.PI/2);
else if(getLoc().getCoordinates().y - getLoc().nextTile.getCoordinates().y < 0)
return (Math.PI);
else if(getLoc().getCoordinates().x - getLoc(... |
5d7cf6ca-abae-4b93-8ab6-d52948100f99 | 7 | public void writeRarifiedSpreadhseet(File filepath, boolean withReplacement, int depth) throws Exception
{
Random random = new Random(24231);
int rarificaitonDepth = depth;
if( depth <= 0)
{ int minIndex = getSampleIdWithMinCounts();
rarificaitonDepth = getCountsForSample(minIndex);
}
BufferedWrit... |
beb86ac3-9064-46f0-b5ae-e58018bdc6a1 | 3 | private void createOneDishOrders(String[] selectedDishes, List<AvailableDish> availableDishs,
GenericDao<OneDishOrder> oneDishOrderDao, int newOrderId) throws SQLException {
for (String selectedDish : selectedDishes) {
for (AvailableDish availableDish : availableDishs) {
... |
e5653291-f396-462b-b6b3-ee8164db3a7f | 3 | public static void printHash(HashMap<String, Integer> hashMap) {
Set<?> s = hashMap.entrySet();
Iterator<?> it = s.iterator();
while (it.hasNext()) {
Map.Entry m = (Map.Entry) it.next();
System.out.println(m.getKey() + "\t" + m.getValue());
}
} |
c26f78f5-fb98-46cb-adf1-6be3e4df715e | 1 | private void closeOutput(){
try {
leavesContentFileWriter.write("Stop: " + getRightNowTimeStr("/", ":", " ") + "\r\n");
leavesContentFileWriter.close();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
} |
210814e1-918d-4925-bd6a-3eb62410f050 | 9 | public JSONArray execute() throws QueryException {
// Build request url using the query
URL requestUrl = null;
try {
requestUrl = new URL(HOST + query);
} catch (MalformedURLException e) {
throw new QueryException(QueryExceptionType.MALFORMED_URL, this, HOST + qu... |
603493ea-306a-4494-b448-035d451e1914 | 4 | public void setZoom(int zoom) {
if (zoom == this.zoomLevel) {
return;
}
TileFactoryInfo info = getTileFactory().getInfo();
// don't repaint if we are out of the valid zoom levels
if (info != null && (zoom < info.getMinimumZoomLevel() || zoom > info.getMaximumZoomLeve... |
68d84919-3c0a-4939-86ab-60ab53a86c9b | 4 | @Override
public int compare(QuizTakenRecord record1, QuizTakenRecord record2) {
if (record1.score > record2.score)
return -1;
else if (record1.score < record2.score)
return 1;
else {
if (record1.timeSpan < record2.timeSpan)
return -1;
else if (record1.timeSpan > record2.timeSpan)
return 1;
... |
71788ddc-b660-4d75-b2b4-c778da60e18c | 9 | private int read_one_field_attribute (int field_index)
{
int name = read2u ();
int length = read4 ();
check_tag (name, CONSTANT_Utf8);
if (equals_utf8 (name, "ConstantValue"))
{
int cv = read2u ();
if (cv < constant_pool_count
&& cv > 0
&& ( tags[cv] == CONSTANT_Integer
|| ta... |
d401a026-2361-40f7-a352-70a4654f6f78 | 9 | private static void handleMoveType6(PGNMove move, String strippedMove, byte color, byte[][] board)
throws PGNParseException {
byte piece = WHITE_PAWN;
int fromvPos = strippedMove.charAt(1) - '1';
int tohPos = getChessATOI(strippedMove.charAt(2));
int tovPos = strippedMove.charAt(3) - '1';
... |
2d687f1f-e5da-44bf-a943-11c00cb8f7e7 | 2 | public int toStartPc(int line) {
int n = tableLength();
for (int i = 0; i < n; ++i)
if (line == lineNumber(i))
return startPc(i);
return -1;
} |
2c4b0294-bfc5-484e-b9c0-c5d1a5a7eaf3 | 2 | public void update() {
if (paused) {
pauseState.update();
return;
}
if (gameStates[currentState] != null)
gameStates[currentState].update();
} |
07a84d30-c037-4b20-addd-b9b786ba9a08 | 0 | public BlogModelDaoJPA(){
} |
9c998c38-f2f6-4008-bdcc-bb6562cbc6bd | 0 | public PosControlSaldos getPosControlSaldosFromPosItem(PhpposItemsEntity item,
int idSolicitud){
PosControlSaldos controlSaldo = new PosControlSaldos();
controlSaldo.setCsaCantidad(item.getQuantity());
controlSaldo.setCsaFechaHora(new D... |
c0302040-c25d-4bac-bd65-01c456822efa | 3 | public double rollOut(StateObservation state)
{
int thisDepth = this.m_depth;
while (!finishRollout(state,thisDepth)) {
int action = m_rnd.nextInt(num_actions);
state.advance(actions[action]);
thisDepth++;
}
double delta = value(state);
... |
86c6bbed-e6d3-474e-ad1e-36ba4379734f | 9 | public int newLocal(final Type type){
Object t;
switch(type.getSort())
{
case Type.BOOLEAN:
case Type.CHAR:
case Type.BYTE:
case Type.SHORT:
case Type.INT:
t = Opcodes.INTEGER;
break;
case Type.FLOAT:
t = Opcodes.FLOAT;
break;
case Type.LONG:
t = Opcodes.LONG;
break;
case Type.DOUB... |
14048154-3003-4412-ba0f-0796621f11e0 | 7 | private static boolean
backrefMatcher(REGlobalData gData, int parenIndex,
char[] chars, int end)
{
int len;
int i;
int parenContent = gData.parens_index(parenIndex);
if (parenContent == -1)
return true;
len = gData.parens_length(parenIndex)... |
3a77a60f-104c-43d7-a739-cee3bb535f84 | 9 | @Override
public boolean doAction(ActionHeader header) {
Player player = header.getPlayer();
StringTokenizer st = player.getCommandST();
String token = "";
if (st.hasMoreTokens()) {
token = st.nextToken();
}
Player enemy = null;
enemy = player.getCurrentRoom().getPlayerByName(token);
if ((play... |
0f85b0aa-4da7-4a1b-86dc-12ce87d04d62 | 5 | public AngleDR Fk45z(AngleDR r1950, double bepoch) {
double w;
int i, j;
/* Position and position+velocity vectors */
double r0[], a1[] = new double[3], v1[] = new double[3], v2[] = new double[6];
/* Radians per year to arcsec per century */
final double pmf = 100.0 * 6... |
29dafdd3-acab-4d04-b6b8-66f9fd42590f | 1 | private void miChangeProfileActionPerformed(ActionEvent e) {
Object[] profileNames = Manager.getInstance().getProfileNames().toArray();
String selectedProfile = (String) JOptionPane.showInputDialog(this,
"Select a player.",
"Profile Select",
JOptionPane.QUESTION_MESSAGE,... |
dbb2bcc4-4e88-4773-a73b-789ad0b2a974 | 6 | public XmlTree scan ()
throws XmlReaderException
{ while (true)
{ while (true)
{ int c=read();
if (c==-1) return null;
if (c=='<') break;
}
if (found("?xml"))
{ String s=scanFor("?>");
if (s==null) return null;
XmlTree t=new XmlTree(new XmlTagRoot());
t.addchild(new XmlTree(new XmlT... |
489e0d68-d0f6-4365-b1f6-a120f025b17e | 5 | protected boolean keyChar(char character, int status, int time) {
// 'i' will zoom in.
if (character == 'i') {
if (!reducedKeypad) {
zoomIn();
return true;
}
}
// 'l' will zoom in on reduced layouts.
if (character == 'l') {
if (reducedKeypad) {
zoomIn();
return true;
}
}
// 'o'... |
0f6f7f35-9d78-43f9-ba49-221a66db631c | 6 | public boolean removeResourceNode(String resource_id)
{
boolean nodeRemoved = false;
int count = 0;
try
{
while((!nodeRemoved) && (count != retryCount))
{
if(count > 0)
{
//System.out.println("REMOVENODE RET... |
ebcc05af-b998-41e3-a5f7-09e92ed03ab2 | 8 | protected void search(String fileName){
startOutput(fileName);
while(!cobweb.getUnsearchQueue().isEmpty()){
final WebPage srb = cobweb.peekUnsearchQueue();// 查找列隊
//初使節點
if(srb.getDepth() == 1){
try {
forefathersNodeFileWriter.write(srb.getUrl() + " ,level=" + srb.getDepth() + "\r\n");
... |
42a86b24-9ed2-47c2-8db1-6c56f5ee78cb | 1 | public void testIsAfter_YM() {
YearMonth test1 = new YearMonth(2005, 6);
YearMonth test1a = new YearMonth(2005, 6);
assertEquals(false, test1.isAfter(test1a));
assertEquals(false, test1a.isAfter(test1));
assertEquals(false, test1.isAfter(test1));
assertEquals(false, test1... |
92d0a869-1730-400b-ab32-1eafad09c81f | 4 | public boolean answerQuestion(Player player, String applicant, String answer) throws SQLException {
String database = plugin.getConfig().getString("mysql.database");
int numberOfQuestions = plugin.getConfig().getList("quiz-questions").size();
String getQuestionNumber = "SELECT * FROM `" + data... |
b847afd0-a1f6-4d9e-a580-c31f1855c70b | 7 | private void lisaaPizza(HttpServletRequest request,
HttpServletResponse response, String action)
throws ServletException, IOException {
// Luodaan pizza- ja tuote-luokkien oliot.
Tuote tuote = new Tuote();
Pizza pizza = new Pizza();
// Esitellään muuttujia.
boolean oreg = false;
boolean vsip = false;... |
1a93bfc1-4e26-4485-a2e4-48a5f783f6cb | 1 | public void removeAllGenerics(){
for(int i=0;i<generics.size();i++){
generics.remove(i);
}
} |
69502259-d9e6-4841-a1ba-ce9ff2b9c1ca | 1 | public void insertAttributes(HttpServletRequest request) {
this.requestAttributes.entrySet().stream().forEach((e) -> {
request.setAttribute(e.getKey(), e.getValue());
});
if (!this.sessionAttributes.isEmpty()) {
HttpSession session = request.getSession();
this... |
865c2dfc-6202-43c5-b4eb-b29d2b45463d | 1 | public void put(Stat s) {
if (!stats.containsKey(s.getType())) {
stats.put(s.getType(), s);
}
} |
039883a6-6f08-4bcf-acfe-97669a68e3f0 | 4 | public Collection<User> getMerchantUsers(Token t, String merchantId)
{
HTTPClient client = GoCoin.getHTTPClient();
client.setRequestOption(HTTPClient.KEY_OPTION_PATH,"/merchants/"+merchantId+"/users");
client.addAuthorizationHeader(t);
try
{
//make the GET request
client.doGET(client.c... |
0451a31f-b0b8-49d2-a997-c4634d42bf84 | 6 | private static final void coeffs (long[][] mat, int mA, int mB, long[] pA, long[] pB) throws Exception {
long[] c = new long [mA + mB];
// store the solution to the linear system in c
int i, j;
for (i = mA + mB - 1; i >= 0; i--) {
c[i] = PF.div(mat[i][mA + mB], mat[i][i]);
... |
0b0702dc-a722-46fa-8034-6fd933d78992 | 6 | private static final int method2925
(int i, int i_168_, byte[] is, int[] is_169_, int i_170_, int i_171_,
int i_172_, int i_173_, int i_174_, int i_175_,
Class348_Sub16_Sub5 class348_sub16_sub5, int i_176_, int i_177_) {
if (i_176_ == 0
|| ((i_173_ = i_171_ + (i_175_ - i_170_ + i_176_ - 257) / i_176_)
> i_... |
9987ba7e-fc86-46e3-8c0a-bcc703c944c7 | 4 | public static void refreshFrame()
{
if(tabbedPane.getSelectedIndex()==0 && (Student.studentListAudio.size()-Integer.parseInt(studentNumberComboBox.getSelectedItem().toString()))>=0)
waitingButton.setText("Waiting : "+(Student.studentListAudio.size()-Integer.parseInt(studentNumberComboBox.getSelectedItem().toStrin... |
f1dd6cb3-c494-4319-b192-5d0a622aa49b | 6 | public String multiply(String num1, String num2) {
if (num1 ==null || num2 ==null ) return null;
if ("".equals(num1.trim()) || "".equals(num2.trim())) return "";
if ("0".equals(num1) || "0".equals(num2)) return "0";
return doMultiply(num1,num2);
} |
5925c44c-d0ae-48c1-adce-61a59ebf2736 | 6 | @Override
public Titre find(int id) {
Titre found = null;
PreparedStatement pst = null;
ResultSet rs = null;
try {
pst=this.connect().prepareStatement("select * from Titre where id= ?");
pst.setInt(1, id);
rs=pst.executeQ... |
08e19fe4-fc97-40d5-ba2e-05fc606efdb3 | 3 | public static synchronized void clear() {
for (Reference<RegionFile> ref : cache.values()) {
try {
if (ref.get() != null) {
ref.get().close();
}
} catch (IOException e) {
e.printStackTrace();
}
}
... |
983fa700-e992-4460-bfa3-7eb9306efecc | 7 | private JSONWriter append(String string) throws JSONException {
if (string == null) {
throw new JSONException("Null pointer");
}
if (this.mode == 'o' || this.mode == 'a') {
try {
if (this.comma && this.mode == 'a') {
this.writer.write('... |
d55db1ca-a5b9-45ed-a2c5-e583480a622c | 6 | public void parseMultiple(){
String[][] inputs = myModel.getInputs();
int size = 1;
if(environment.myObjects != null) size = environment.myObjects.size();
int uniqueInputs = inputs.length/size;
Grammar currentGram = grammar;
if(environment.myObjects != null) currentGram = (Grammar)environment.myObjects.get(... |
0d86deef-c9fc-4eb2-a4e4-ece4164d6f9d | 7 | public synchronized RegularTimePeriod advanceTime() {
RegularTimePeriod nextInstant = this.pointsInTime[this.newestAt].next();
this.newestAt = this.oldestAt; // newestAt takes value previously held
// by oldestAT
/***
* The next 10 lines or so ... |
50a3bc5a-1834-42d5-88c8-eb69ffaea96f | 3 | private boolean eight_byte_size_ready() {
// The payload size is encoded as 64-bit unsigned integer.
// The most significant byte comes first.
final long msg_size = ByteBuffer.wrap(tmpbuf).getLong();
// Message size must not exceed the maximum allowed size.
if (maxms... |
33c50f81-dd30-467d-b559-696a9f7acd1c | 0 | public static boolean getIfDefaultClient(){ return DefaultClient; } |
1fa569fa-bd14-42f0-a1da-95fa0c1880ab | 3 | public static String[] getRawFile(String filePath) {
ArrayList<String> lines = new ArrayList<String>();
try {
String line = "";
BufferedReader in = new BufferedReader(new FileReader(filePath));
while((line = in.readLine()) != null) {
lines.add(line);
}
in.close();
} catch (Fil... |
1715e450-51c5-4334-8ca7-c006abfc008d | 8 | @Override
public boolean invoke(MOB mob, List<String> commands, Physical givenTarget, boolean auto, int asLevel)
{
if(!super.invoke(mob,commands,givenTarget,auto,asLevel))
return false;
if((!auto)
&&(!mob.isMonster())
&&(!disregardsArmorCheck(mob))
&&(!CMLib.utensils().armorCheck(mob,CharClass.ARMOR_LEA... |
56ee8f30-2ec1-43ff-8255-0eeed7086e72 | 8 | private double[] exc_proportion_efficient(String measure) {
int type = get_type(measure);
if (((type != STATE_BASED) && (type != INTERVAL_BASED)) || measure.equals("Utilisation")) {
throw new Sim_stat_exception("Invalid measure type. Must be state-based or interval-based.");
}
if (type == STATE_BA... |
174e8cd6-cd35-44b8-91bd-1aa472f5d1d7 | 2 | public void disableGPS() throws IllegalAccessError, SocketTimeoutException {
try {
clientSocket.Escribir("OFFGPS\n");
serverAnswer = clientSocket.Leer();
} catch (IOException e) {
throw new SocketTimeoutException();
}
if(serverAnswer.contains("530 ERR")) {
throw new IllegalAccessError();
}
Syste... |
a04a1d50-16bf-4eca-90bd-59508a83b03a | 7 | public static void main(String[] argv){
FileNameResolver fnr = new FileNameResolver("data");
String path = "";
boolean toWrite = false;
if(argv.length==2){
path = argv[1];
toWrite = true;
}
if (argv[0].equals("-complex")){
ComplexAnalyzer complexAnalyzer = new ComplexAnalyzer(fnr.getFiles());
... |
57301180-810e-4fbf-acc4-cb3197993737 | 2 | @EventHandler(priority = EventPriority.LOWEST)
public void onPlayerJoinEvent(PlayerJoinEvent event) {
try {
Player player = event.getPlayer();
PermissionUser user;
if (plugin.isUseUUID()) {
user = plugin.getDataManager().getUser(event.getPlayer().getUnique... |
0b44a1a0-6a93-4c26-8d1b-b11d8fb631e4 | 1 | @Override
protected void createReaderWriter() throws JoeException {
ourReaderWriter = new PdbTMReaderWriter() ;
if (ourReaderWriter == null) {
throw new JoeException(UNABLE_TO_CREATE_OBJECT) ;
}
} |
35a9a563-f202-4919-bc0b-6d25a2dd2edb | 2 | private void showAboutPanel() {
String html = MessageFormat.format(resources.getString("dialog.about.text"), new Object[] { resources.getString("version.id") });
String[] props = { "java.version", "java.vendor", "java.home", "os.name", "os.arch", "os.version", "user.name", "user.home", "user.dir" };
html +=... |
eebdc002-0ebd-4778-8d66-2e28651e4748 | 7 | @Override
protected VcfEntry readNext() {
// Read sequence from file (if needed)
if( (seq == null) || seq.isEmpty() ) readSequence();
// Read another line from the file
try {
while(ready()) {
line = readLine();
if( line == null ) return null; // End of file?
if( lineNum > 1 ) { // Ignore title... |
9e3b811a-947f-4533-afa1-70bcf80afbd3 | 5 | public MainMenu(int width, int height, User u) {
user = u;
this.setSize(width, height);
this.setLayout(new GridLayout(1,1));
JButton instructions =new JButton("Instructions");
JButton playGame =new JButton("Play New Game");
JButton savedGame =new JButton("Play Saved Game");
JButton viewLeaderBoard =... |
5e78093e-2c84-4177-b46a-55dc2929796a | 7 | public String getModDependency(String modName){
if(modName.equals("base")) return "";
JSONParser parser = new JSONParser();
try {
Object obj;
if(modName.contains(".zip")){
getJsonFromZip(modPath + modName);
obj = parser.parse(new FileReader(System.getProperty("java.io.tmpdir") + "/" + modName.re... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.