method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
08009e86-afea-4c6d-92ae-ce5355a5f5cd | 8 | private boolean readRomanPage()
{
ArrayList<Character> saved = new ArrayList<Character>();
char token = nextChar();
int len = 0;
// saved leading newline chars
while ( token=='\n'||token=='\r' )
{
saved.add(token);
token = nextChar();
}... |
7294d58f-f4d4-423a-8420-d97b18a6501e | 6 | private void loadData() {
clear();
String filename = Main.filenameResolver.getProvinceHistoryFile(provId);
if (filename == null) {
// must be terra incognita.
return;
}
provData = EUGFileIO.load(filename, ParserSettings.getDefaul... |
0be518a9-6c53-4b8a-adc6-b1f25fb544ed | 6 | public Building(int t) {
super(true, 0);
if(type == 1){
ManaCost = 3;
Name = "Caves";
Description = "Grants +2/0 to those inside of it, but those inside can't attack";
}else if(type == 2){
ManaCost = 4;
Name = "Castle";
Description = "Grants +5 Health to the player, but this is not factored into... |
b0c9df7c-9bed-4e22-8620-81c822dd3691 | 9 | private void checkResults( DenseMatrix64F a_orig ,
DenseMatrix64F b_orig ,
DenseMatrix64F c_orig ,
DenseMatrix64F r_orig )
throws InvocationTargetException, IllegalAccessException
{
double alpha = 2.5;
... |
1dc91596-5509-468c-a9f8-5f18859bfd03 | 1 | public PreferenceString getOwnerName() {
if (useDocumentSettings()) {
return this.ownerName;
} else {
return Preferences.getPreferenceString(Preferences.OWNER_NAME);
}
} |
883b82e3-b74e-47b3-9961-fb81e8656416 | 0 | public ContextFreeGrammar() {
super();
} |
00fdaa81-4ca9-4680-8e08-a3f236fa18ce | 1 | public void configureForExport(OutlinerDocument doc, String protocolName, String currentDirectory) {
lazyInstantiate();
// adjust title
setDialogTitle("Export: " + protocolName);
// adjust approve button
setApproveButtonToolTipText("Export file as named");
// Set the Accessory state
setAccessory(export... |
afec54b8-4337-41b3-becc-fa1574265158 | 9 | public boolean configureLayer(final String workspace, final String resourceName,
final GSLayerEncoder layer) throws IllegalArgumentException {
if (workspace == null || resourceName == null || layer == null) {
throw new IllegalArgumentException("Null argument");
}
// TODO... |
a822e871-7170-4c4e-864a-a4e6d576410b | 0 | public String getAxisKey(Axis axis) {
return _key + axis.getValue();
} |
ddbe062b-b5cf-4498-a8dc-afa75b3a25d4 | 5 | public ListNode rotateRight(ListNode head, int n) {
if (head == null) return head;
int length = 0;
ListNode p = head,q;
int m = n;
while ( p != null)
{
p = p.next;
length ++;
}
m = n % length;
if ( m == 0) return head;
p = head;
while (m >0) { p =... |
14bec472-9c64-4dd7-bd3b-38ca7fb70f0e | 2 | @Override
public T validate(String fieldName, T value) throws ValidationException {
if (value == null) {
return null;
}
if (min.compareTo(value) >= 0) {
throw new ValidationException(fieldName, value, "must be greater than " + min);
}
return value;
} |
7b377072-1b37-4ddf-bd65-be40cd7056a2 | 3 | private Object handleRefn(Object tos) {
if (tos instanceof PersonFamilyCommonContainer) {
return new FieldRef(tos, "ReferenceNumber");
}
else if (tos instanceof Source && ((Source)tos).getReferenceNumber() == null) {
return new FieldRef(tos, "ReferenceNumber");
}
return n... |
6b23c95e-2a23-4a16-b932-daf83296db69 | 4 | public void getChoiceIndex(String choice){
if(choiceIndicies.get(operations.peek().start)!=null){
Choice c = choiceIndicies.get(operations.peek().start);
Option op = c.get(choice.toLowerCase());
if(op!=null){
Operation o = new Operation("choice", op.getBounds());
operations.add(o);
index = o.star... |
b2585833-4707-4522-a78d-6b1c014de687 | 5 | public static BufferData bufferHalfSphere(float r, int scalex, int scaley)
{
BufferData.Key key = BufferData.createKey(r, scalex, scaley);
if(cache.containsKey(key))
return cache.get(key);
int i, j;
FloatBuffer buf = FloatBuffer.allocate(scalex * s... |
67d435b7-cd0a-41c9-8581-1f5e592428f3 | 1 | protected long getLong(final String key) {
if (getProperty(key) == null) throw new RuntimeException("long key not found in configuration: " + key);
return Long.parseLong(getProperty(key));
} |
0360e01d-eeb2-4385-800a-d0c44bfb7156 | 3 | public MinimizePane(FiniteStateAutomaton dfa, Environment environment) {
// Set up the minimizable automaton, and the minimize tree.
minimizer = new Minimizer();
minimizer.initializeMinimizer();
dfa = (FiniteStateAutomaton) minimizer.getMinimizeableAutomaton(dfa);
// minimizer.initializeMinimizer();
TreeMod... |
6ead0646-a3b2-4e43-97a2-85f63f1b69f3 | 9 | @SuppressWarnings("null")
private static AreaNode splitNode(AreaNode node) {
AreaObject oldStorage[] = new AreaObject[MAX_PER_NODE + 1];
int oldStorageCount = node.mStorageCount;
int largestWasted = -1;
AreaObject firstShape = null;
AreaObject secondShape = null;
boolean addToFirst = true;
AreaNode split... |
67d7da07-1c19-456c-bb3a-6af53fee52ec | 7 | private Binarytree teePuustaTaydellinen(Binarytree tree, int korkeus) {
int tamanHetkinenKorkeus = korkeus;
int solmujenMaara = 1;
int korkeudenLaskemisraja = 1;
LinkedList list = new LinkedList(tree.getRoot());
Node nykyinen = list.getHeadNode();
while (list.getSize() !=... |
febc5efb-a5ff-4869-9f75-77c3af5c677b | 0 | public int getID() {
return id;
} |
5d97e039-243a-4644-aa64-1b2ec2b07821 | 3 | @Override
public boolean waitForCardAbsent(long timeout) throws CardException {
long sleeptime = timeout / POLLING_INTERVAL;
for (short i = 0; i < POLLING_INTERVAL; i++) {
if (!isCardPresent())
return true;
try {
Thread.sleep(sleeptime);
} catch (InterruptedException e) {
break;
}
}
ret... |
97466656-7ac7-430f-ad7a-595f39e54840 | 0 | public void testReadWriteWithNIO() throws Exception {
byte[] data = FileUtils.readWithNIO("g:\\test\\a.jpg");
FileUtils.writeWithNIO(data, "g:\\test\\aa2.jpg");
data = FileUtils.readWithNIO("g:\\test\\t.txt");
FileUtils.writeWithNIO(data, "g:\\test\\tt2.txt");
data = FileUtils.readWithNIO("g:\\test\\t.txt", ... |
9469bf5a-4e39-4d8e-aeb0-6544d20650e0 | 2 | public void testGetFieldType_int() {
LocalDateTime test = new LocalDateTime(COPTIC_PARIS);
assertSame(DateTimeFieldType.year(), test.getFieldType(0));
assertSame(DateTimeFieldType.monthOfYear(), test.getFieldType(1));
assertSame(DateTimeFieldType.dayOfMonth(), test.getFieldType(2));
... |
2849b1c4-6a7b-4b4a-83e4-703380a89e36 | 1 | public String execute() throws Exception
{
HttpClient client = null;
GetMethod get = null;
try
{
String requestUrl = generateRequestUrl();
System.out.println(requestUrl);
client = new HttpClient();
get = new GetMethod(requestUrl);
client.executeMethod(get);
return get.getResponseBodyAsStr... |
00c90caf-24ca-4026-8648-db685e9ecfc9 | 8 | public void loadRepositoryFromGeneXML(String geneXML) {
if (geneXML == null || geneXML.equals(""))
return;
try {
//System.out.println(geneXML);
Document document = builder.parse(new InputSource(new StringReader(geneXML)));
// genome
NodeLis... |
a5a183e5-6280-44e5-ac8c-a14c8a8f5185 | 8 | private void InitFont(Font f) {
Image img = Image.createImage(FONT.INIT_IMAGE_WIDTH, FONT.INIT_IMAGE_HEIGHT);
int[] rgbData = new int[FONT.INIT_IMAGE_WIDTH * FONT.INIT_IMAGE_HEIGHT];
Graphics g = img.getGraphics();
g.setColor(0xFF000000);
g.fillRect(0, 0, FONT.INIT_IMAGE_WIDTH, FONT.INIT_IMAGE_HEIGHT);
g.... |
897a0304-c062-4e5b-9894-9029ac570010 | 1 | public static String reverseWord(String s) {
StringBuilder sb = new StringBuilder(s.length());
for(int i=s.length() - 1;i>=0;i--) {
sb.append(s.charAt(i));
/* alternative method
* new StringBuilder(s).reverse().toString();
*
*/
}
return sb.toString();
} |
4af833a9-3d7f-43f6-b499-f1708f41fedf | 3 | public Object getValue(Object pRowObject) {
try {
Object value = mGetter == null ? pRowObject : mGetter.invoke(
pRowObject, null);
return mFormat == null ? value : mFormat.format(value);
}
catch (Exception e) {
e.printStackTrace();
... |
25f759ee-08b2-4934-a120-2cba31ab20b0 | 1 | public void doGet(HttpServletRequest request, HttpServletResponse response) {
response.setContentType("text/html");//设置服务器响应的内容格式
// response.setCharacterEncoding("gb2312");//设置服务器响应的字符编码格式。
DButil ab = new DButil();
try {
PrintWriter pw = response.getWriter();
St... |
1751f4f2-3cf5-48ad-9e5f-6633818226ff | 8 | public void actionPerformed(ActionEvent ae)
{
try
{
if (ae.getSource() == this.tmrReadLine)
{
try
{
if ((!this.continueRun) || (this.killThread) || (this.sktMyConnection.isClosed()))
{
closeThread();
}
}
catch (Exception loc... |
31a91f72-c028-4c56-a5d3-e24ff215e7bd | 7 | public boolean DumbSolve(Point in, Point out){
clearVars();
lastChecked.add(in);
int lock = 0;
boolean running = true;
while(running){
toCheck.clear();
for(Point p : lastChecked){
for(Point q : getPointsAround(p)){
doStuff(q);
}
}
for(Point p : toCheck){
pathSize[p.x]... |
01488719-bee5-4fd6-8258-2d800815eafb | 7 | public final void method68(int i, int i_22_, int[] is, int i_23_,
int i_24_, int i_25_, int i_26_, int i_27_) {
if (((Class310_Sub2) this).aClass304_3896 != Class108.aClass304_1662
|| ((Class310_Sub2) this).aClass68_3895 != Class68.aClass68_1183)
throw new RuntimeException();
PixelBuffer pixelbuff... |
9ceae99c-a7f8-4288-9271-5142748fb95e | 5 | private static boolean[] primeBoolArray(int limit) {
boolean[] nums = new boolean[limit];
for (int i = 2; i < nums.length; i++)
nums[i] = true;
int nextPrime = 2;
while (nextPrime < nums.length / 2) {
int i = nextPrime;
for (; i < nums.length; i += nextPrime)
nums[i] = false;
nums[nextPrime] = t... |
250551dd-468e-42f8-a65e-2dd39ad0f4c8 | 6 | private void chop() {
final GameObject tree = ctx.objects.select().select(ObjectDefinition.name(ctx, "Tree")).nearest().select(new Filter<GameObject>() {
@Override
public boolean accept(GameObject o) {
return o.tile().derive(-1, 0).matrix(ctx).reachable()
|| o.tile().derive(1, 0).matrix(ctx).reachable... |
45f936cb-c15d-46c5-a834-790a3f3d3692 | 3 | public Object next() {
Object o = null;
// Block if the Queue is empty.
synchronized(_queue) {
if (_queue.size() == 0) {
try {
_queue.wait();
}
catch (InterruptedException e) {
return null;
... |
913b5b57-2cc5-4429-b489-e72428267242 | 4 | public Map<Integer, SingleRunScore> scoreSubjectDec2011(Experiment goldStandard, TobiiData subjectData, Map<Integer, List<Double>> recordMap) {
Map<Integer, SingleRunScore> scoreMap = new HashMap<Integer, SingleRunScore>();
for(Integer trialID : subjectData.getTrajectories().keySet()) {
// Old version: exactly... |
e8d77272-0b8e-4ad4-95ed-98a9a91d9cce | 7 | private String convertProduct(Product product)
{
StringBuffer result = new StringBuffer();
//First the uriref for the subject
result.append(startTagWA(3, "Product", "id", new Integer(product.getNr()).toString()));
//rdfs:label
result.append(leafTag(4, "label", product.getLabel()));
//rdfs:comment
res... |
fc7e54e1-3671-40dd-805f-22ddf7a70c8a | 9 | public Object getProperty(String name){
if (!hasProperty(name)) throw new IllegalArgumentException("property doesnt exist :"+name);
if (name == null) throw new NullPointerException("name is null");
switch (getGType(name)) {
case G_TYPE_BOOLEAN:
return getBooleanProperty(name);
case G_TYPE_FLOAT:
return ... |
51af821f-449b-4c5a-85cc-7577af21b69a | 4 | public void save() {
if (this.getServer() == null) {
System.out.println("Cannot save file without server");
return;
}
Database db = getServer().getController().getDb();
if (getId() == 0) { // new
try {
db.insertOne("files", columns, getCreatedAt(), getModifiedAt(), getServerid(),
getServercat... |
36dd9413-711a-46a1-9acd-8c6d94266a3f | 4 | public void render(GameContainer gc, Graphics g) throws SlickException {
if (state != Scene.STATE.INVISIBLE) {
if (state == Scene.STATE.ON) CustomRender(gc, g);
if (state == Scene.STATE.FREEZE_NEXT) {
sence.getGraphics().clear();
CustomRender(gc, sence.get... |
8b54f0e0-0d71-4ea3-8097-2f954965e44d | 2 | public static int getLocalOS() {
String osName = System.getProperty("os.name");
if (osName.startsWith("Windows")) {
return OS_WIN;
}
if (osName.startsWith("Mac")) {
return OS_MAC;
}
return OS_LIN;
} |
4c4e8f49-ddf7-4470-87f0-28c87e8e90a6 | 8 | @Test
public void testGetDescriptionFirstPhone() {
Map<String, Object> descriptionFirstPhone = new HashMap<String, Object>();
descriptionFirstPhone.put("name", "3Gs");
descriptionFirstPhone.put("brandName", "Apple");
descriptionFirstPhone.put("screenSize", 5);
descriptionFirstPhone.put("screenType", ScreenTy... |
cb8a6a97-1a80-4c9b-b0ad-17ea4fc400cb | 3 | public double calcEucDistance (BCNode b) {
double sumDSquared = 0.0;
int n = Math.max(this.getNumAttributes(), b.getNumAttributes());
for(int i = 0; i < n; i++) {
Double ai = this.getAttribute(i);
Double bi = b.getAttribute(i);
if( ai == null || bi ==... |
86c8addf-c5d8-4585-a46a-899f894c6472 | 8 | public byte[] createPayload(String argument ){
try{
File[] filelist = new File(client.sharedDirectory).listFiles();
number_hits=0;
int i=0;
for (File file : filelist) {
if (file.isFile()) {
if(file.getName().matches("(?i).*"+argument.substring(1, argument.length()-1)+".*")){
fil... |
9c0340c7-0750-4b73-9633-6c8a5eb0af59 | 3 | private void buildStack(GeneralTreeNode<T> cur) {
if (cur != null)
stack.push(cur);
while (!stack.isEmpty()) {
GeneralTreeNode<T> tmp = stack.pop();
OutputQueue.add(tmp);
Iterator<GeneralTreeNode<T>> it = tmp.getChildren();
while (it.hasNext()) {
this.buildStack(it.next());
}
}
... |
e65f3434-2774-47d3-a9f8-e9551d5dd31a | 2 | @Override
public boolean equals(Object o) {
if (this == o) return true;
if (!(o instanceof SubTheme)) return false;
SubTheme subTheme = (SubTheme) o;
return id == subTheme.id;
} |
1c8fc9fc-ca9e-4992-9da5-661524cbdfdb | 2 | public void payOut(double value)
{
//Saldo �berpr�fen wenn er unter 0 ist dann muss auch die kredit Limite �berpr�ft werden
if(super.saldo < 0 )
{
//Wird die Abhebeung die Limite sprengen dann nicht abheben
if(Math.abs(super.saldo - value) > this.creditLimit )
{
return;
... |
e635a858-f3fe-4b94-a257-bf7ca334a20a | 9 | public void setHotKeys(Display display) {
display.addFilter(SWT.KeyDown, new Listener() {
public void handleEvent(Event e) {
// Ctrl + a: display all task
if ((e.stateMask == SWT.CTRL) && (e.keyCode == 97)) {
addBoldTextInCommandHistory(commandHistory, "display all");
displayFeedback(uiSwitch.e... |
d3cf960d-19d9-4f2e-8c14-d16593b4965f | 1 | public void addElements(List<ZElement> elements)
{
Iterator<ZElement> e = elements.iterator();
while (e.hasNext())
addElement((ZElement) e.next());
} |
b7278b1d-6204-48ff-82b9-0ad3ca2e8605 | 6 | public static void countWithStateful() throws NamingException, InterruptedException {
int i, lostTimes = 0;
long threadId = Thread.currentThread().getId();
boolean lost = false;
RemoteSFSB sfb = lookupRemoteSFSB();
System.out.println(threadId + ": Obtained a remote stateful bean for invocation.");
lon... |
b3dfab0e-6bad-4eae-96d5-4ec90e3e3ebc | 8 | public TestInfo getTestRunStatus(String userKey, String testId, boolean detailed) {
TestInfo ti = BmTestManager.getInstance().getTestInfo();
if (userKey == null || userKey.trim().isEmpty()) {
BmLog.debug("TestRunStatus cannot be received, userKey is empty");
ti.setStatus(TestSta... |
0981dbbf-79fd-4c7b-ab15-46e302b9dcc8 | 3 | @Test
public void testDetectCouriers() throws Exception {
//get trackings of this number.
List<Courier> couriers = connection.detectCouriers(trackingNumberToDetect);
assertEquals("It should return 2 couriers", 2, couriers.size());
//the couriers should be dpd or fedex
assert... |
f0295c94-0c62-4158-9e5c-6986c12292ec | 6 | public int execute() {
if( HTTPHandler.sharedInstance == null ) {
System.out.println( "Error: cannot run this command because there is no shared HTTPHandler instance." );
return -1;
}
if( this.getName().equalsIgnoreCase(ModuleCommand.COMMAND_HEXDUMP) ) {
if( this.offset >= this.getParamCo... |
b8199235-76e6-42ba-b245-247962ff208e | 3 | @JavaScriptMethod
public void stopAlarm() {
if (isDemoModeEnabled()) {
CiLightGlobalConfiguration config = CiLightGlobalConfiguration.get();
List<Endpoint> endpoints = config.getEndpoints();
for (Endpoint endpoint : endpoints) {
try {
s... |
65b069c1-1023-44da-9f59-b615ed7eeb2d | 6 | public void start() throws IOException {
File[] fileList = new File(statusesDir).listFiles();
PrintWriter errorLogWriter = new PrintWriter(new File(
"./logs/ActiveUserExtractor-error-log.txt"));
PrintWriter logWriter = new PrintWriter(
"./logs/ActiveUserExtractor-log.txt");
BufferedWriter writer = new B... |
68cf0331-2a12-4a15-9aae-3995c2b1ef2e | 6 | public boolean receiveBook(IssueBookVO issueBookVO)
throws LibraryManagementException {
ConnectionFactory connectionFactory = new ConnectionFactory();
Connection connection;
try {
connection = connectionFactory.getConnection();
} catch (LibraryManagementException e) {
throw e;
}
PreparedStatement ... |
a26c714f-dda0-4a8e-9493-94968cb915b7 | 7 | public static ArrayList<ItemSet<String>> readFile(String filename) throws IOException
{
BufferedReader reader=new BufferedReader(new FileReader(new File(filename)));
ArrayList<String> attributeNames=new ArrayList<String>();
ArrayList<ItemSet<String>> itemSets=new ArrayList<ItemSet<String>>();
String line=reade... |
b1170587-94a0-424b-8ac9-b8276fa6bb51 | 6 | public void drawFlippedSprite(int x, int y) {
x += offsetX;
y += offsetY;
int destOff = x + y * Graphics2D.width;
int srcOff = 0;
int height = this.height;
int width = this.width;
int destStep = Graphics2D.width - width;
int srcStep = 0;
if (y < Graphics2D.topY) {
int topMargin = Graphics2D.topY - ... |
19c1ac09-c2d2-449f-917e-759f833647f5 | 4 | public void merge(Iterable<? extends Player> updateDatabase) {
Map<String, Player> master = getMergeMap(masterDatabase);
Map<String, Player> update = getMergeMap(updateDatabase);
for (Map.Entry<String, Player> crnt : update.entrySet()) {
String key = crnt.getKey();
Playe... |
a5d182fe-9191-4464-bcde-ec3baa1e9c83 | 5 | public static void addMessage(MessageType type, String message) {
List<HTMLElement> messages = (List<HTMLElement>) Session.getCurrent()
.get("message.list");
switch (type) {
case ERROR:
messages.add(new Error(message));
break;
case INFO:
messages.add(new Info(message));
break;
case ALERT:
m... |
5280f872-12e3-47f5-9d21-909286ff434b | 9 | public ArrayList<Integer> parseMidi(File midi) throws Exception {
Sequence sequence = MidiSystem.getSequence(midi);
ArrayList<Integer> notes = new ArrayList<Integer>();
long noteOffTime = Long.MAX_VALUE;
boolean firstNote = true;
for (Track track : sequence.getTracks()) {
for (int i=0; i < track.size(); i... |
c2dd3c33-83c4-4fef-84da-77cf79f843c3 | 0 | public void display() {
Message message = createMessage();
log.debug(message.toString());
} |
bf7269ac-4807-48e0-aee1-2604193fc321 | 5 | private void trimUp(Node node) {
for (Node n : node.children) {
if (n != null)
return; // not empty, do nothing
}
// all children empty, remove node
for (int i = 0; i < BASE; i++) {
if (node.parent.children[i] == node) {
node.parent.children[i] = null;
break;
}
}
// recursively c... |
a1951280-d6fb-4df8-aba5-c41092eb8785 | 3 | private void codeTextCaretUpdate(javax.swing.event.CaretEvent evt) {//GEN-FIRST:event_codeTextCaretUpdate
// TODO add your handling code here:
String code;
code = codeText.getText();
System.out.println(code);
if (codeText.getText().equals("")) {
return;
}
RulesSet rules = new R... |
a596dc53-5316-4e72-9a35-e7d04009d18f | 6 | public void paint(Graphics g, JComponent c) {
// parent's update method fills the background
prepareGraphics(g);
JLabel label = (JLabel) c;
String text = label.getText();
Icon icon = (label.isEnabled()) ? label.getIcon() : label
.getDisabledIcon();
if (... |
0fdd1303-cada-477f-81eb-05989cc94d1f | 3 | public synchronized void setStop(boolean cr) {
stop=cr;
if(server!=null && cr==true) {
try {
server.close();
} catch (Exception e) {
System.err.println("Error closing server : setStop : "+e);
}
}
} |
11476c2a-bcc2-44da-a222-54ae016f45b3 | 3 | public static double convert(double valueInput, Unit unitInput, Unit unitOutput) {
if(unitInput.getType().equals(unitOutput.getType())) {
// convertir � l'unit� r�f�rence du syst�me (si l'unit� d'entr�e n'est pas l'unit� r�f�rence)
double refValue;
if(unitInp... |
d869a09e-81da-46ae-b418-5d45cd9ef1be | 0 | public String toString(){
return "(" + x + ", " + y + ")";
} |
cbaf23a7-31ef-4a21-a01f-da5be4af4f6b | 4 | public void saveImage() {
if (history.isEmpty()) {
System.out.println("No image to save");
return;
}
JFileChooser jfc = new JFileChooser();
jfc.setDialogTitle("Choose an Image");
jfc.showDialog(null, "Done");
jfc.setVisible(true);
File file = jfc.getSelectedFile();
if (file == null)
return;
S... |
b5b9654e-0ba3-4fa4-898b-800c856c1ac4 | 0 | @Test
public void determineHighestFlush_ifSixOfSameSuit_returnsSetOfSixCards() {
assertFlushOfSize(getAllFlushCards(sixFlushWithStraight()), 6);
} |
7fce20d5-80e2-47b3-b959-6eaf41cb5d4e | 0 | @Override
public Iterator<AbstractPlay> iterator() {
return everyPlay.iterator();
} |
ea84a912-fb30-4045-b6ec-a9982b56cb9a | 1 | private void hardDrop() {
while (tetromino.tryMove(this, Direction.DOWN));
placeTetromino();
} |
9547c208-50c1-47c1-99f0-be4d035878cf | 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... |
bac0e7c7-d0e2-42d1-816a-ed4091914f84 | 6 | public SortedMap[] parser(JSONObject json) throws JSONException {
//System.out.println(json); //DUMP JSON
SortedMap mapuser = new TreeMap();
SortedMap mapmessages = new TreeMap();
Iterator i = json.keys();
while (i.hasNext()) {
String key = (String) i.next();
... |
a52f0e6e-d097-4f88-a4c2-2b1cd9655b48 | 0 | public String getCountry() {
return addressCompany.getCountry();
} |
aecaf947-5537-468f-a646-5f81ae1f075a | 4 | public boolean isOverDue(boolean dateOnly) {
if (this.getDueDate() == null)
return false;
Calendar today = Calendar.getInstance();
if (today.compareTo(this.getDueDate()) > 0) {
if (dateOnly) {
if (!org.apache.commons.lang3.time.DateUtils.isSameDay(
today,
this.getDueDate()))
return t... |
86c65f1e-906d-474f-a706-12459b2b4055 | 4 | public void deleteBook(long id) {
Connection con = null;
Statement stmt = null;
try {
DBconnection dbCon = new DBconnection();
Class.forName(dbCon.getJDBC_DRIVER());
con = DriverManager.getConnection(dbCon.getDATABASE_URL(),
dbCon.getDB_US... |
6c0e28ab-7cc0-43aa-89ad-579a39125bd3 | 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... |
b20e0436-57b0-415c-b74b-5730c8b4cda0 | 9 | private void AjustaHorarioComCurso(int idcurso,List<HorarioCursoBeans> hc){
try {
// lmateria=new MateriaDao().BuscaMateriaCurso(idcurso);//busca materia do curso
List<ProfessorHorarioBeans> phb=new ArrayList<>();
AuxHorarioCursoDao ahcd=new AuxHorarioCursoDao();
... |
5fb2c0cf-a10e-4b62-98be-e4ec90480a00 | 3 | @Override
public void applyCurrentToApplication() {
//Preferences prefs = Outliner.prefs;
PreferenceBoolean pShowIndicators = Preferences.getPreferenceBoolean(Preferences.SHOW_INDICATORS);
PreferenceColor pDesktopBackgroundColor = Preferences.getPreferenceColor(Preferences.DESKTOP_BACKGRO... |
8cf650b7-1de3-470f-b9b3-950b565eb5fb | 5 | private static StronglyConnectedComponents createStronglyConnectedComplement() throws ConfigurationException {
StronglyConnectedComponents scc;
String clazzName = Conf.getTheoryAnalyser_stronglyConnectedComponentClassName();
try {
if (!AppConst.isDeploy) System.out.println("generating scc class [" + clazzName ... |
b3cf6068-f9c9-433b-84fb-8e329c8a3b51 | 3 | public Path getImgPath_SliderArrowDown(Imagetype type) {
Path ret = null;
switch (type) {
case DEFAULT:
ret = this.imgSliderArrowDown_Def;
break;
case FOCUS:
ret = this.imgSliderArrowDown_Foc;
break;
c... |
7d3ac828-0ebe-4daa-8b08-d7bcfeea61a6 | 3 | @Override
public boolean equals(Object obj) {
if (obj == null || !(obj instanceof NumberToken)){
return false;
}
NumberToken other = (NumberToken) obj;
return (type == other.type) && (value == other.value);
} |
9fa3ef0d-402a-46db-b0d1-0a7a0e472a4b | 6 | protected String getCommonSuperClass(final String type1, final String type2) {
Class c, d;
try {
c = Class.forName(type1.replace('/', '.'));
d = Class.forName(type2.replace('/', '.'));
} catch (Exception e) {
throw new RuntimeException(e.toString());
}
if (c.isAssignableFrom(d)) {
return type1;
... |
d45fa06c-2b91-4eae-b8cf-ee0e20821dba | 0 | public int getSide()
{
return side;
} |
42a2508c-0816-45ed-a14e-533ad9155699 | 9 | public void hear(Call call, double x1, double y1){
if(call.getContent()=="Food"){
if(energy < energyMax*.6 ){
setDirection(Math.atan2(y1-getY(),x1-getX()));
}
}
if(call.getContent()=="Mate"){
if(energy > energyMax*.2 ){
if(age >= pu... |
fd064bb6-4f1f-42b1-8608-55f747d4bc1e | 7 | @EventHandler (priority = EventPriority.NORMAL)
public void onPlayerInteractWithBlock(PlayerInteractEvent event){
Player p = event.getPlayer();
Block b = event.getClickedBlock();
if(b != null && !b.getType().equals(Material.AIR)){
if(!RPSystem.permission.has(p, plugin.config.getString("block-restriction.ov... |
185a1397-8960-469c-a799-cbabe46c631d | 0 | public String getRegex() {
return regex;
} |
9d9c89d1-f1cb-464c-9752-588470c5c889 | 2 | public void testProperty() {
YearMonthDay test = new YearMonthDay(2005, 6, 9);
assertEquals(test.year(), test.property(DateTimeFieldType.year()));
assertEquals(test.monthOfYear(), test.property(DateTimeFieldType.monthOfYear()));
assertEquals(test.dayOfMonth(), test.property(DateTimeField... |
cd5f6446-9c70-4b7c-8434-40be57bce667 | 3 | public synchronized void append(String str) {
try {
//System.out.println(str);
mutex.acquire();
if (count == size) {
full.wait();
}
buffer[last] = str;
last = (last + 1) % size;
count = count + 1;
full.notify();
full.release();
mutex.release();
for(String s : buffer){
//... |
e894fd17-0c21-48a9-bad1-4abcab21fcc4 | 9 | public static void doJob() {
Timestamp startDay = Timestamp.valueOf("2011-01-01 00:00:00.0");
Timestamp nextDay = new Timestamp(startDay.getTime() + oneDayLong);
final Timestamp endDay = Timestamp.valueOf("2012-05-01 00:00:00.0");
while (startDay.before(endDay)) {
System.out.println(startDay); // print in... |
9796b4c1-595a-4d8b-9ae2-83a9e3e0e23b | 5 | String removeNewLine(StringBuilder sb) {
if (sb == null) return null;
if (sb.length() <= 0) return "";
// Remove trailing newlines
for (char c = sb.charAt(sb.length() - 1); c == '\r' || c == '\n';) {
sb.deleteCharAt(sb.length() - 1);
if (sb.length() > 0) c = sb.charAt(sb.length() - 1);
else break;
... |
3a6241a9-98db-4b07-9be0-82eccad9b510 | 1 | public static void updateActionCom(int idaction, int idactiontype, int idutilisateur, Date dateaction, String actioncommercial) throws SQLException {
String query = "";
try {
query = " UPDATE ACTION_COM SET ID_ACTION_TYPE=?,ID_INTERLOCUTEUR=?,ACTDATE=?,ACTCOMM=? where ID_ACTION=? ";
... |
65e48bfd-f206-47e7-9be7-f2b5e84a3b42 | 6 | @SuppressWarnings("unchecked")
public static <T> T unwrap(Entry entry, Class<T> clazz) throws JAXBException {
setFinder(entry);
if (entry.getAnyOtherElement() == null && entry.getAnyOther().isEmpty())
return null;
T object = entry.getAnyOtherJAXBObject(clazz);
if (object == null) {
for (Objec... |
9f6f1d71-8168-4e68-af0c-8bfed4ad639f | 6 | @Override
public double nominaPorDepartamento(int id) {
List<Trabajador> trabajadores = findTrabajadoresEntities(true, -1, -1);
List<Supervisor> supervisores = findSupervisorEntities(true, -1, -1);
double ret = 0.0;
for (Trabajador t : trabajadores )
{
... |
6062b4f7-4b19-46a4-8ada-bc19e549574b | 2 | private void btnExportAFDActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnExportAFDActionPerformed
JFileChooser saveFile = new JFileChooser();
int selected = saveFile.showSaveDialog(this);
if(selected == JFileChooser.APPROVE_OPTION){
String path = saveFile.getSelectedFile()... |
6d4254c1-576c-41c0-a23e-827efaf83e7a | 8 | public ArrayList<ArrayList<Integer>> permuteUnique(int[] num) {
ArrayList<ArrayList<Integer>> result = new ArrayList<ArrayList<Integer>>();
if (num.length == 0)
return result;
if (num.length == 1) {
ArrayList<Integer> onlyList = new ArrayList<Integer>();
onlyList.add(new Integer(num[0]));
result.add(... |
76add184-59f1-4922-98cf-46238b94494a | 5 | private void blueProcStrategy(Tilia x) {
final Solver solver;
if (this.blueProcStrategy.equals(GameLogic.PROCESSING_STRATEGY.DYNAMIC_SOLVER)) {
solver = new DynamicSolver(x.getSide());
} else if (this.blueProcStrategy.equals(GameLogic.PROCESSING_STRATEGY.RECURSIVE_SOLVER)) {
solver = new RecursiveSolver()... |
90757c75-bb79-47e8-aae7-d63677dee75a | 3 | @EventHandler(ignoreCancelled = true, priority = EventPriority.HIGHEST)
public void onPlayerCraft(PrepareItemCraftEvent event) {
ItemStack item = event.getRecipe().getResult();
if(item.getType().equals(Material.WRITTEN_BOOK) && item.hasItemMeta())
if(item.getItemMeta().getDisplayName().equalsIgnoreCase(ConfigHa... |
f01de1c6-a697-4501-92f5-f5f1784da803 | 2 | private void storeError(final String error) {
//Render and disappear it
new Thread() {
public void run() {
ERROR = error;
try {
Thread.sleep(2000);
} catch (InterruptedException e) {
e.printStackTrace();
... |
5094a52a-95f8-4069-b909-eb5463c0549f | 7 | public void send_request(byte[] client_random, byte[] rsa_data,
byte[] username, byte[] hostname) throws RdesktopException,
IOException, CryptoException {
int sec_flags = Secure.SEC_LICENCE_NEG;
int userlen = (username.length == 0 ? 0 : username.length + 1);
int hostlen = (hostname.length == 0 ? 0 : hostnam... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.