method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
090057c5-dc93-448f-ab38-3dff326905b3 | 3 | private static boolean isEmptyMap(Map<?, ?> map) {
return null == map || map.isEmpty();
} |
a9d276e6-33a3-481f-b7d4-aa5167a3b5fb | 4 | public static void main(String[] p_agrs) {
try {
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
}
catch (ClassNotFoundException e) {
e.printStackTrace();
}
catch (InstantiationException e) {
e.printStackTrace();
}
catch (IllegalAccessException e) {
e.printStackTrac... |
2c68cabf-54a3-4894-a1ae-c1119bf8ce84 | 6 | public static int[][] lenghtLCS(int[] x, int[] y){
// TODO Auto-generated method stub
int m = x.length;
int n = y.length;
int[][] c = new int[m + 1][n + 1];//保存LCS(Xi,Yj)的长度
for(int i=0; i<m; i++){
for(int j=0; j<n; j++){
if(x[i] == y[j]){
c[i + 1][j + 1] = c[i][j] + 1;
}else{
if(c[i]... |
c621689f-66a8-447b-a8d0-4d6f91644bbb | 3 | public static void main(String[] args) {
int no_of_students;
int no_of_scores;
Scanner scan = new Scanner(System.in);
String[] firstInput = scan.nextLine().split(" ");
no_of_students = Integer.parseInt(firstInput[0]);
no_of_scores = Integer.parseInt(firstInput[1]);
String[] names = new String[no_of_stu... |
2aaf0a6d-2059-4e9f-bbbc-b69a1963514d | 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... |
627c17c8-c1ac-4541-88b7-ca225df5b8f5 | 1 | public void runResultView(){
if(resultView == null){
resultView = new ResultView("Result");
}
} |
989f2365-d992-42a4-9064-495d8e92003b | 8 | @Override
public boolean allocateHostForVm(Vm vm)
{
double minMetric = -1;
PowerHost ChoosenHost = null;
//Log.formatLine("In ChooseHostForNewVm function...");
for (PowerHost host : this.<PowerHost> getHostList()) {
... |
f83076aa-6778-4c24-ad0e-bfc1c4b01f4a | 3 | @Override
public void serialize(Buffer buf) {
buf.writeByte(teleporterType);
buf.writeUShort(mapIds.length);
for (int entry : mapIds) {
buf.writeInt(entry);
}
buf.writeUShort(subAreaIds.length);
for (short entry : subAreaIds) {
buf.writeShort(e... |
2ce791bf-3e8c-42f2-ab3b-8817b1df38f7 | 8 | public String cambio(String palabra, int brin) {
int al=0,r=0;
String cambio = " ",cambio2="",cambio3="",cambio4="";
String acum = "", acum2 = "", acum3 = "", acum4 ="";
for (int i = 0; i < palabra.length(); i++) {
acum="";
acum += palabra.charAt(i);
... |
bbfb0ec0-8ad9-4adb-b4df-a469d1e84d4f | 7 | private void findPrimes () {
myPrimes = new ArrayList<Integer> ();
// Create many threads
Thread[] threads = new Thread[myNumThreads];
for (int i=0; i<myNumThreads; i++) {
threads[i] = new Thread () {
@Override
public void run() {
... |
e8049990-a31c-44bf-a81a-bf1054f4691e | 3 | public static boolean esPalindrom(String p1) {
Stack s1 = new Stack();
String p2 = "";
// Emplanem l'Stack amb la caracters separats de la paraula p1 que ens
// an entrat
for (int i = 0; i < p1.length(); i++) {
s1.push(p1.charAt(i));
}
// Concatanem tot l'stack al reves
while (!s1.empty()) {
p2 ... |
27ca7f60-3c2e-4f17-906a-facba16ace23 | 1 | @Override
public void changedMostRecentDocumentTouched(DocumentRepositoryEvent e) {
OutlinerDocument doc = (OutlinerDocument) e.getDocument();
updateText(doc);
if (doc != null) {
calculateEnabledState(doc.getTree());
}
} |
dbf8322c-a661-4bc1-a483-c21002c3e988 | 9 | public void scrollAndAnimateTo(int index) {
if(loadingDone && (scrollerTimer == null ||
!scrollerTimer.isRunning())) {
if (index < 0)
index = 0;
else if (index >= avatars.size())
index = avatars.size() - 1;
DrawableAvatar drawable = ... |
b446eb6d-c919-44ff-a450-d8e11ec18cfb | 0 | public ArrowMinimizeTool(AutomatonPane view, AutomatonDrawer drawer) {
super(view, drawer);
} |
4e6deb4b-32a0-4d54-a2ad-49c0ebe77139 | 9 | private boolean checkContent(VElement elem, T o, Method m) throws Exception {
if (getAnnotation(m, Content.class) == null) {
return false;
}
Class cls = m.getReturnType();
String value = null;
if (!cls.isPrimitive() && !isWrapperType(cls) && cls != String.class) {
// otherwise check if i... |
3c935ca5-1a6e-4846-a1f2-6fe38445ea1a | 4 | @Override
public void tick() {
if (!paused) {
if (isWon()) {
if (gameOverListener != null) {
gameOverListener.onGameOver(true);
}
}
ticksSinceMove++;
if (ticksSinceMove >= TICKS_PER_MOVE) {
tetro... |
dac68785-8d27-4814-bcca-fdef1777e7fd | 2 | public void run(){
try {
while(true){
message = in.readLine();
out.println(type + message);
}
} catch (IOException e) {
e.printStackTrace();
}
} |
090a5c07-1491-4e74-a299-978a0d9c7721 | 3 | private static String[][] parseStringArray(DynamicArray<String> matrix) {
if (matrix.get(0).toLowerCase().equals("directed")) {
matrix.delete(0);
directed = true;
} else {
directed = false;
}
String[][] adjacencyMatrix = new String[matrix.getSize()][ma... |
6609352d-87b3-4a09-9ce5-c4742256acc3 | 2 | public void set_LabOrder(MsgParse mp)
throws SQLException {
String labOrderProvider = "";
try {
// We need to get the provider ID from the initial Visit which was sent by bedboard
PreparedStatement prepStmt = connection.prepareStatement(
"select at... |
f309fe0b-6b14-4e67-9ada-c75e220ff70b | 7 | private AbstractNode<V> optimize(MutableNode<V> n) {
if (n.getChildren() == null) {
// this is a leaf node
return new LeafNode<V>(n.getPrefix(), n.getValue());
}
if (n.getChildren().length == 1) {
// this is a single-child node
return new SingleChildNode<V>(n.getPrefix(), n.getValue... |
0d592723-42b3-4c16-aa86-bb370decfd94 | 7 | public boolean[] getAction()
{
double[] inputs;// = new double[numberOfInputs];
byte[][] scene = levelScene;
inputs = new double[numberOfInputs];
int which = 0;
for (int i = -3; i < 4; i++) {
for (int j = -3; j < 4; j++) {
inputs[which++] = probe(i... |
b18986ee-13c7-48e9-b053-635d336d54fa | 2 | @EventHandler
public void onQuit(PlayerQuitEvent e){
Player p = e.getPlayer();
if(Main.Main.players.contains(p)){
Main.Main.players.remove(p);
Main.Main.playerTeam.remove(p);
tm.removePlayer(p);
for(Player broad : Main.Main.players){
broad.sendMessage(Main.Main.Prefix + "§c" + p + " §ahat das Spiel... |
547cf41c-39d6-4659-89f6-25835de61513 | 5 | public static void main (String[] args)
{ //abre public main
//declarações
InputStream entrada = System.in;
Scanner scanner = new Scanner (entrada);
float a, b, valor, igual;
String op;
//fimDeclarações
System.out.println("Siga as instruções a seguir para usar a calculad... |
cdfc40e4-b76a-4a5f-9272-f4d202bc067c | 2 | public final void modifyHunger(int toMod)
{
hunger+=toMod;
if(hunger > 100)
{
hunger = 100;
}
else if(hunger < 0)
{
hunger = 0; //kinda screwed
}
} |
249bca54-8791-43cd-ac35-afaadb0c4e0e | 6 | @Test(expected=IOException.class)
public void malformedUrl() throws IOException {
TeleSignRequest tr;
if(!timeouts && !isHttpsProtocolSet)
tr = new TeleSignRequest(":junk/rest.telesign.com", "/v1/phoneid/standard/15551234567", "GET", "customer_id", "");
else if(timeouts && !isHttpsProtocolSet)
tr = new Tel... |
f86c2fdb-a24e-4643-8536-7e25a6dd0270 | 4 | public Transition getExistingOutgoingTransition(Transition t) {
Transition existing = null;
State toState = t.getToState();
for(int i=0; i<outgoingTransitions.size() && existing == null; i++) {
State from = outgoingTransitions.get(i).getFromState();
State to = outgoingTra... |
8d27b00e-6944-47d4-a3ea-6bc1a112eb74 | 0 | public String getFileFilterExclude() {
return this.fileFilterExclude;
} |
46207f53-3c77-4598-94f9-8ca6f7a71c60 | 1 | */
public void addInstruction(final Instruction inst) {
Assert.isTrue(!inst.isJsr() && !inst.isConditionalJump(),
"Wrong addInstruction called with " + inst);
this.next = null;
addInst(inst);
} |
7e96c65f-f6dc-4492-ad08-f1d12da16a2a | 3 | public void updateScores(Player winner) {
Player[] players = new Player[Game.linkedGet().getNumPlayers()];
int[] playerScores = new int[players.length];
for (int i = 0; i < players.length; i++) {
players[i] = Game.linkedGet().getPlayers().get(i);
playerScores[i] = Game.d... |
0c6799f3-cf83-4483-9219-afe28afff86e | 4 | @Override
public boolean equals(Object obj) {
System.out.println("user equals");
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
User other = (User) obj;
if (id != other.id)
return false;
return true;
} |
749d35bb-198a-488e-95c9-049222f590ff | 2 | public void testProperty() {
LocalTime test = new LocalTime(10, 20, 30, 40);
assertEquals(test.hourOfDay(), test.property(DateTimeFieldType.hourOfDay()));
assertEquals(test.minuteOfHour(), test.property(DateTimeFieldType.minuteOfHour()));
assertEquals(test.secondOfMinute(), test.property... |
8aa3f045-804f-4c1a-b36d-27cf64f5a191 | 0 | public Configuration build(String consumerKey, String consumerSecret, String accessToken, String accessSecret) {
ConfigurationBuilder cb = new ConfigurationBuilder();
cb.setDebugEnabled(true)
.setOAuthConsumerKey(consumerKey)
.setOAuthConsumerSecret(consumerSecret)
.setOAuthAccessToken(acces... |
e2ea863b-ba48-441a-8422-8e6b642a0756 | 7 | private boolean jj_3R_16() {
Token xsp;
xsp = jj_scanpos;
if (jj_3_56()) jj_scanpos = xsp;
xsp = jj_scanpos;
if (jj_3_57()) jj_scanpos = xsp;
xsp = jj_scanpos;
if (jj_3_58()) {
jj_scanpos = xsp;
if (jj_3_59()) {
jj_scanpos = xsp;
if (jj_3_60()) {
jj_scanpos = xsp;
if ... |
5f58b261-4b04-4a13-8fc3-0351af94aada | 8 | public void nextPermutation(int[] nums) {
if (nums == null || nums.length == 0) {
return;
}
int start = -1, end = -1;
for (int i = nums.length - 2; i >= 0; i--) {
if (nums[i] < nums[i + 1]) {
start = i;
break;
}
... |
58cb60e5-693b-4c32-bc08-305b63b8adef | 4 | private boolean boardEquals(Board board0, Board board1) {
boolean result = true;
for (int i = 0; i < board0.getFields().length; i++) {
if (board0.getFields()[i] != board0.getFields()[i]) {
result = false;
}
}
for (int i = 0; i < board0.getFields().length; i++) {
if (board0.coordinates[i] != board1.... |
73bd9368-eb33-4571-8182-f5c46832c151 | 4 | public boolean exists(String w) {
String word = w.toUpperCase();
for (int row = 0; row < board.length; row++) {
for (int col = 0; col < board[0].length; col++) {
if (word.charAt(0) == board[row][col])
if (check(word.substring(1), row, col))
return true;
}
}
return false;
} |
684dbe26-253d-436d-a94b-430faf608434 | 7 | public static int evalRPN(String[] tokens) {
if(tokens==null||tokens.length==0){
return 0;
}
Stack<Integer> stack = new Stack<Integer>();
for(String token : tokens){
if(token.equals("+")){
stack.push(stack.pop() + stack.pop());
}else if(token.equals("-")){
int rOp... |
a69339fb-5a2c-4fff-bf38-4f07a1fce57b | 1 | public boolean jumpMayBeChanged() {
return (catchBlock.jump != null || catchBlock.jumpMayBeChanged());
} |
a912c44e-dee2-4a73-9fa3-7a77ca85b02e | 2 | public static void write() throws Exception
{
if (patchNo == 0)
{
newFile = new File(ActionHandler.outputPatchSelectedFile.toString() + "/Patch.txt");
}
else
{
newFile = new File(ActionHandler.outputPatchSelectedFile.toString() + "/Patch" + patchNo + ".txt");
}
if (newFile.exists())
{
Syst... |
1dcc2624-1e3b-48f9-9f3b-0670f51ce62f | 7 | public void renderTiles(Screen screen, int xOffset, int yOffset, boolean isForeground) {
if (xOffset < 0)
xOffset = 0;
if (xOffset > ((width << 4) - screen.width))
xOffset = ((width << 4) - screen.width);
if (yOffset < 0)
yOffset = 0;
if (yOffset > ((h... |
1853fead-1159-4419-8956-9546d657cb09 | 0 | StarSystemEnum(String nameObject, double mass, float radius, SimpleVector initialPosition, SimpleVector velocity) {
this.nameObject = nameObject;
this.mass = mass;
this.radius = radius;
this.initialPosition = initialPosition;
this.velocity ... |
0ea8c1f7-110b-4182-81a1-bf3e567e654e | 5 | @Override
public void processAI() {
if (!move()) {
goldAdded = true;
setDead(true);
GameConfig.player.spendLife();
}
for (Effect effect : effects)
if (modifier != null)
modifier.inflict(effect, this);
else
effect.inflict(this);
Iterator<Effect> it = effects.iterator();
while (it.hasNe... |
9cbe9a95-f25c-4901-964b-a2fb84a08d08 | 2 | public void map_place(int x, int y, int btn, int mod) {
if (plob != null) {
Gob pgob;
synchronized (glob.oc) {
pgob = glob.oc.getgob(playergob);
}
if (pgob == null)
return;
Coord mc = tilify(pgob.position());
Coord offset = new Coord(x, y).mul(tileSize);
mc = mc.add(offset);
wdgmsg("pl... |
aad0a597-7d29-4d58-b962-952c3505708b | 1 | public void setCommandButtonFonttype(Fonttype fonttype) {
if (fonttype == null) {
this.buttonComFontType = UIFontInits.COMBUTTON.getType();
} else {
this.buttonComFontType = fonttype;
}
somethingChanged();
} |
adfe947f-9a59-478c-901a-a2a3f51266b9 | 5 | static final void method226(int i, int i_0_, int i_1_, int i_2_,
int i_3_) {
for (int i_4_ = i_2_; Class348_Sub38.anInt7008 > i_4_; i_4_++) {
Rectangle rectangle = Class180.aRectangleArray2371[i_4_];
if ((rectangle.width + rectangle.x ^ 0xffffffff) < (i ^ 0xffffffff)
&& (rectangle.x ^ 0xffffffff) > (i_... |
54f92451-acad-42e8-b8fa-3f7a970a5d70 | 4 | @Override
public Map<Noppa, Integer> poistaPienempiPari(Map<Noppa, Integer> kelpoisatnopat){
Map<Noppa, Integer> nopatlistalla = kelpoisatnopat;
if(super.tyyppi==8) {
Noppa poistettavanoppa = null;
for(Noppa noppa : nopatlistalla.keySet()) {
poistettavanoppa =... |
92077530-7e1a-49ec-90f3-aec21386811b | 2 | public String getSessionQuery(int session, int subsession) {
String query = new String();
//piece together the query string
if (sessionExists(session, subsession)) {
query = "&Session=" + ((session <= 20) ? "rd" : "jd") + session + "l" + subsession + "se";
} else {
... |
d778de2a-ecce-4483-8c48-56acb474796a | 4 | private void improveCorners() {
Point[] newP = new Point[corners.size()];
for (Corner c : corners) {
if (c.border) {
newP[c.index] = c.loc;
} else {
double x = 0;
double y = 0;
for (Center center : c.touches) {
... |
4787b510-4a46-45e2-ae3f-02c366f85c40 | 2 | public SMELTGui() {
final JPanel center = new JPanel();
center.setLayout(new GridBagLayout());
final JPanel pinPanel = new JPanel();
pinPanel.setLayout(new BorderLayout());
pinPanel.setBorder(new TitledBorder("Bank pin"));
frame = new JFrame("Tornado's AIO Smelter");
frame.setMinimumSize(new Dimensi... |
d07c1b05-edd9-4d0f-882e-d9f585b8f278 | 4 | public void saveInstrument(VInstrument toSave)
{
if (toSave.isBuilt())
{
File target;
JFileChooser fileChosser = new JFileChooser();
int option = fileChosser.showSaveDialog(VMainWindow.window);
switch (option)
{
case JFileC... |
c6fe90a6-fa10-4520-88a6-e28a8529d429 | 6 | public void startElement(String uri, String localName, String name, Attributes attributes)
throws SAXException
{
if (RECORD.equals(name))
{
currentRecord = new QuickBaseRecord();
}
else if (F.equals(name))
{
currentField = new StringBuffer();
... |
3892d91f-c2e3-40ce-be20-5e396ce34d28 | 1 | void gameLoop(){
if(!running){
clientListen.running = false;
return;
}
game.operateEntities(period);
game.sendData(clientListen.streams, gameTime, clientListen.newPlayer);
clientListen.newPlayer = -1;
gameTime += period;
} |
be00ff8b-e103-4daf-9ab1-20e748e240b3 | 5 | private void saveAll()
{
try{
FileOutputStream saveFile = new FileOutputStream("save.sav");
ObjectOutputStream save = new ObjectOutputStream(saveFile);
ArrayList<SaveVariables> lowerVar = new ArrayList<SaveVariables>();
ArrayList<SaveVariables> middleVar = new ArrayList<Sa... |
138f9908-8cb4-4449-bf17-e756b158e89c | 8 | @Override
public void run()
{
int numberOfThreads = settings.getInt("threadCount");
threads = new TestCaseThread[numberOfThreads];
for(int i = 0; i <= numberOfThreads - 1; i++)
{
threads[i] = new TestCaseThread(i + 1, testCase.clone(), settings);
... |
b5d49d47-6e46-44e5-8ec6-2f167b2d57bc | 0 | public void testApp()
{
assertTrue( true );
} |
866e042b-2d0e-4ed5-b869-d85c450f1e82 | 0 | public void setCompanyId(long companyId) {
this.companyId = companyId;
} |
e0d45c62-c81f-4e86-a070-6203ea288fcd | 5 | protected Invocable getInvocable(String path, MapleClient c) {
try {
path = "scripts/" + path;
engine = null;
if (c != null) {
engine = c.getScriptEngine(path);
}
if (engine == null) {
File scriptFile = new File(path);
if (!scriptFile.exists())
return null;
engine = sem.getEngineBy... |
c8a7d14d-69d7-4c26-a3f7-4b18f8feec40 | 9 | public void render(int xp, int yp, Sprite sprite){
xp -= xOffset;
yp -= yOffset;
for(int y = 0; y < sprite.getHeight(); y++){
int ya = y + yp; //y absolute position is equal to y + yOffset
int ys = y;
for(int x = 0; x < sprite.getWidth(); x++){
int xa = x + xp;
int xs = x;
if(xa < -(sprite.g... |
962eebe3-780f-474d-9a53-56ce63b8bb1d | 8 | protected boolean canSinkFrom(Room fromHere, int direction)
{
if((fromHere==null)||(direction<0)||(direction>=Directions.NUM_DIRECTIONS()))
return false;
final Room toHere=fromHere.getRoomInDir(direction);
if((toHere==null)
||(fromHere.getExitInDir(direction)==null)
||(!fromHere.getExitInDir(direction).i... |
345a208d-10c5-47ff-9f5c-b1d6b5e26a31 | 3 | private boolean jj_3R_48() {
if (jj_3R_60()) return true;
if (jj_scan_token(COLONEQUAL)) return true;
if (jj_3R_49()) return true;
return false;
} |
ae9554e2-3215-4022-8e82-d64c52d57f54 | 6 | @Override
public void build(JSONObject json, FieldsMetadata metadata, IContext context) {
// iterate on all images
Iterator<?> iter = json.entrySet().iterator();
while (iter.hasNext()) {
Map.Entry<?,?> entry = (Map.Entry<?,?>)iter.next();
// set the FieldsMetaData
metadata.addFieldAsImage(entry.getKey()... |
4530f9da-ddf8-4281-81fd-6a347593e919 | 0 | public boolean currentlyTransmitting() {
return active;
} |
28ab0962-8442-474e-856f-6b371dc529d6 | 2 | public SpriteSheet getSheet(String name){
for(SpriteSheetTicket ticket : this.tickets){
if(ticket.getName().equals(name)){
return ticket.getSheet();
}
}
Debug.error("SpriteSheet not found '" + name + "'");
return null;
} |
0ea85d63-5dae-448e-b278-642a8f3901ca | 1 | public boolean isAutoscrollOnStatus() {
if(frame == null) buildGUI();
return autoscrollStatus.isSelected();
} |
2c91c533-9c22-4f1a-8f6c-8f95410aba2b | 1 | public List<Candy> getCandy() {
if (candy == null) {
candy = new ArrayList<Candy>();
}
return this.candy;
} |
2c179511-a350-4c55-b5e8-49efa2bb94c6 | 8 | public static void main(String[] args) {
String[] words = {"one","two","three","four","five","six",
"seven","eight","nine","ten","eleven","twelve",
"thirteen","fourteen","fifteen","sixteen","seventeen",
"eighteen", "nineteen", "twenty", "thirty", "forty",
"fifty", "sixty", "seventy", "eighty",... |
5e23bd26-5c78-419d-b9e4-2b36427735b1 | 0 | public void setAlgorithm(String value) {
this.algorithm = value;
} |
d686285c-077e-4368-95aa-1e6dfa1b8985 | 2 | public Production[] getUnitProductions(Grammar grammar) {
ArrayList list = new ArrayList();
ProductionChecker pc = new ProductionChecker();
Production[] productions = grammar.getProductions();
for (int k = 0; k < productions.length; k++) {
if (ProductionChecker.isUnitProduction(productions[k])) {
list.a... |
19229f96-8867-4dea-9fe3-afe3a3413717 | 6 | @Override
public void printState() {
for (Field field : this) {
if (field.getPosition() != 0 && field.getPosition() % sizeX == 0) {
System.out.println("");
}
if (field.getPosition() % sizeX == 0 && field instanceof FakeField)
System.out.pri... |
27f86bcb-1118-4a83-8e28-a98154ab8586 | 9 | public boolean find(int key) {
Tree234Node node = root;
while (node != null) {
if (key < node.key1) {
node = node.child1;
} else if (key == node.key1) {
return true;
} else if ((node.keys == 1) || (key < node.key2)) {
node = node.child2;
} else if (key == node.key... |
884a7bb1-0f32-4eac-86d0-2bb0a497a3a2 | 1 | public void setTileInstancePropertiesAt(int x, int y, Properties tip) {
if (bounds.contains(x, y)) {
Object key = new Point(x, y);
tileInstanceProperties.put(key, tip);
}
} |
8338337a-f4fa-4d7e-a6fb-1d00fec834ef | 8 | public static boolean wawD(Instruction i1, Instruction i2)
{
// No dependency on branches or assembly directives
if (i1.instructionType==3 || i1.instruction.equals("NOP")) return false;
if (i2.instructionType==3 || i2.instruction.equals("NOP")) return false;
// Ensure 1 writes after 2 writes
if(!(i2.memor... |
9cb2a069-8a6c-421d-8041-1c209bbea2b8 | 0 | void countCustomers() {
DateFormat df = new SimpleDateFormat("yyyy-MM-dd");
Date d = new Date();
String currentDate = df.format(d);
String sql = "SELECT COUNT(*) FROM Sales WHERE SUBSTR(DateTime, 1, 10) = ?;";
String count = getPersist().read(String.class, sql, currentDate);
... |
eb38573b-f6fb-4b6d-af2f-03a90b3283ef | 5 | public void sort(double[] input) {
int N = input.length;
int h = 1;
while (h < N / 3) {
h = 3 * h + 1; // 1, 4, 13, 40, 121, 364, 1093, ...
}
while (h >= 1) { // h-sort the array.
for (int i = h; i < N; i++) { // Insert a[i] among a[i-h], a[i-2*h], a[i-3*h]... .
for (int j = i; j >= h && Helper.less... |
74cf77b4-846c-4490-8542-797ff372689d | 8 | public int Open(String Filename, int NewMode)
{
int retcode = DDC_SUCCESS;
if ( fmode != RFM_UNKNOWN )
{
retcode = Close();
}
if ( retcode == DDC_SUCCESS )
{
switch ( NewMode )
{
case RFM_WRITE:
try
{
file = new RandomAccessFile(Filena... |
92242e63-4a4b-4743-9c4e-cf6c8571486c | 0 | String defaultMethod()
{
return "default";
} |
7c9579ab-92b6-47b1-b3fc-666e86f5c6dc | 5 | public static <T> boolean equalDeep(T[] a1, T[] a2) {
if (a1 == null) return a2 == null;
if (a2 == null) return false;
if (a1.length != a2.length) return false;
for (int i = 0; i < a1.length; ++i) if (!Calc.equal(a1[i], a2[i])) return false;
return true;
} |
62a226c0-bf2f-451a-9eb0-7b0084c6e5bd | 0 | public List<Element> getAll() {
return this.elements;
} |
756abd57-d10c-4f51-846e-9e5eb8cdcb7a | 5 | private void interpretData(String msg) {
Scanner scan = new Scanner(msg);
String firstWord =scan.next();
switch (firstWord){
case nameKey: // Client is alerting server to the name of the character connecting.
String name = scan.next(); // Msg of form: "N [na... |
544efb1c-2643-4570-86bb-3129a64d2492 | 4 | @Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
// if(obj instanceof Integer) {
// if(image_id == (int) obj) {
// System.out.println("TSCHAKKA"); // FIXME
// return true;
// }
// }
if (!(obj instanceof Image)) {
return fa... |
00e78fdf-ef3d-449a-b11c-09037661e7b0 | 0 | public void setAutostart(Boolean autostart) {
this.autostart = autostart;
} |
75f3b346-f64a-4e15-9ef4-60c24b1963a3 | 9 | public void commandLine() {
while (true) {
System.out.print(">");
command = userInput.nextLine().split(" ");
//String junk = userInput.next();
if (command[0].equals("addplayer")) {
comAddplayer();
} else if (command[0].equals("removeplayer")) {
comRemoveplayer();
} else if (command[0].equals... |
63197838-6b46-485a-911e-6a5fefb6e14d | 1 | public DataStore setTeachers(ArrayList<Teacher> teachers) {
//System.out.println("DataStore.setTeachers() : " + teachers);
if (teachers != null)
this.teachers = teachers;
else
this.teachers = new ArrayList<Teacher>();
return this;
} |
0fab28cb-7820-4f66-a705-db4d5a537607 | 1 | public int compareTo(Entry e) {
int i = score - e.getScore();
if(i == 0) return name.compareTo(e.getName());
return i;
} |
84aebf04-301d-4588-89b5-fb8c25f342c4 | 8 | public List<Statement> parse(Map<String, Integer> labels) {
List<Statement> statements = new ArrayList<Statement>();
while (true) {
// Ignore empty lines.
while (match(TokenType.LINE));
if (match(TokenType.LABEL)) {
... |
489b0bac-6c9c-4a1e-a64d-270b9d0064dd | 5 | public void actionPerformed(ActionEvent ae)
{
if (mApply.equals(ae.getSource()) || mOK.equals(ae.getSource()))
{
for (int i = 0; i < mPanels.size(); i++)
{
E5OptionPanel panel = (E5OptionPanel) mPanels.elementAt(i);
panel.savePreferences(mPreferences);
}
}
if (mCancel.equals(ae.getSource()) ... |
5688e0bc-d867-478e-a42c-5ad3ce5ba4e3 | 0 | public Gopinich(int room) {
super(new FireBall(), new MeteorStorm(), 65.0*room, 152.0*room, 103.00*room, 2.0*room, 50.0*room, 55.0*room, "Gopinich");
} // End DVC |
38850c99-4901-493f-b48b-50c1f0fe9b2f | 7 | public static void main(String[] args) {
InputStreamReader stdin = new InputStreamReader(System.in);
BufferedReader cache = new BufferedReader(stdin);
System.out.println("Are you new? (yes|no)");
String choice = "";
try {
choice = cache.readLine();
} catch (IO... |
358a34e0-4dfc-4d8b-9066-a01bad68d59b | 4 | public void editMeal(long id, String newName, double newCalories, double newProtein) {
SimpleMealDaoImpl dao = getSimpleMealDaoImpl();
Session session = null;
Transaction tx = null;
try {
session = HbUtil.getSession();
//TRANSACTION START
tx = session... |
d32e370d-93eb-4600-a9ba-c0edb7536af6 | 6 | public void setElement(int itemId, double rating){
int beginIndex = 0, halfIndex = 0, endIndex = itemIds.length;
if(itemIds.length > 0) {
while(true){
halfIndex = (endIndex - beginIndex) / 2 + beginIndex;
if(itemId < itemIds[halfIndex]){
if(endIndex - beginIndex <= 1){
break;
}
endIn... |
d9b8e521-90cc-4a17-a6b6-a9beffd5b8ad | 4 | public static void main(String[] args) {
System.out.println("SERVERDb: main");
ServerDb serverDb;
try {
serverDb = new ServerDb();
args = new String[3];
args[0] = "jdbc:derby://localhost:1527/JHelpDB";
args[1] = "adm";
args[2] = "adm";
... |
760e759a-6305-40d0-8217-2a68fb76e9ca | 1 | @Override
public AFUNIXSocket accept () throws IOException {
if ( isClosed() )
throw new SocketException("Socket is closed");
AFUNIXSocket as = AFUNIXSocket.newInstance();
this.impl.accept(as.impl);
as.addr = this.boundEndpoint;
NativeUnixSocket.setConnected(as);
... |
c797c6e0-eb18-4a81-9303-b9fb96144f97 | 9 | @Override
public void keyPressed(KeyEvent e) {
int key = e.getKeyCode();
System.out.println(KeyEvent.getKeyText(key));
if (key == KeyEvent.VK_LEFT)
scrollX -= tileSize / 4;
else if (key == KeyEvent.VK_RIGHT)
scrollX += tileSize / 4;
else if (key == KeyEvent.VK_UP)
scrollY -= tileSize / 4;
else ... |
31486747-792b-4001-aa9e-d863fa3e0fd4 | 2 | public boolean isBot(long userId) {
long currTotal = totalEvents.incrementAndGet();
if (currTotal%10000 == 0) {
System.out.println("Handled " + totalEvents + " requests and curent table entries " + allElements.size());
}
UidBaseElement uide = allElements.get(userId)... |
a603b63e-5b1f-40ca-b316-a8893b568d5f | 9 | @Override
protected void handleMessage(Object o) throws Throwable {
if(state != null && state.isDisconnected()) {
agentPrintMessage("Peer disconnected, ignoring message "+o.getClass().getCanonicalName());
return;
}
try {
if(o instanceof UncheckedMnTreeMessage) {
handleUncheckedMnTreeMessage(o);
... |
fbe3e580-ea33-4fa9-b830-3cd59f9a7085 | 9 | private void btn_aceptarActionPerformed(java.awt.event.ActionEvent evt) {
if (lab_modo.getText().equals("Alta")){
if (camposCompletos()){
if (validarFechas()){
ocultar_Msj();
insertar();
... |
28f6f884-418e-4e91-b090-05bc4583ecf6 | 9 | public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(new FileReader(args[0]));
String s;
while ((s = br.readLine()) != null) {
String[] a = s.split(",");
List<String> b = new LinkedList<String>();
List<String> c = new LinkedList<String>();
for (int ... |
43811785-66e5-495c-8f20-21982ff15bda | 3 | public char nextClean() throws JSONException {
for (;;) {
char c = this.next();
if (c == 0 || c > ' ') {
return c;
}
}
} |
7a71c76d-52a0-4de4-90ae-9f3dc8f23872 | 8 | @Override
public void aiStep() {
this.inventory.tick();
this.oBob = this.bob;
this.input.updateMovement();
super.aiStep();
float var1 = MathHelper.sqrt(this.xd * this.xd + this.zd * this.zd);
float var2 = (float)Math.atan((double)(-this.yd * 0.2F)) * 15.0F;
if(var1 > 0.1F) {
var1 = 0.1F;
}
if(!t... |
355a4221-6578-40b6-96dc-95467e61a558 | 0 | @Override
public final void testAssumptionFailure(final Failure failure) {
super.testAssumptionFailure(failure);
selectListener(failure.getDescription()).testAssumptionFailure(failure);
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.