method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
0ea0ab54-014f-4d97-916c-7b0136c3a2fb | 9 | private void placeLightGrenadeNearPlayer() {
for (Player p : players) {
boolean placed = false;
int minX = p.getPosition().getxCoordinate() - 2;
int maxX = p.getPosition().getxCoordinate() + 2;
int minY = p.getPosition().getyCoordinate() - 2;
int maxY = p.getPosition().getyCoordinate() + 2;
if (... |
eed89b13-4e68-4fce-8180-b8162c134bdc | 1 | public boolean connects(RouteLeg routeLeg)
{
return this.routeLeg.getStartNode().equals(routeLeg.getStartNode()) &&
this.routeLeg.getEndNode().equals(routeLeg.getEndNode());
} |
d268abb0-c999-4505-b8f4-6215d3f51162 | 8 | private void addDependentType(String canonicalName)
{
Class<?> toAdd = null;
try {
toAdd = Class.forName(canonicalName);
} catch (ClassNotFoundException e) {
//System.err.println("Warning: class not found (" + canonicalName + ")");
}
if (toAdd != null &&
Modifier.isPublic(toAdd.getModifiers()) &... |
9a1df02a-c782-4bf6-bc4a-eb6574b6065d | 6 | private void getSample () {
// Tell the main thread we getting audio
gettingAudio=true;
int a,sample,count,total=0;
// READ in ISIZE bytes and convert them into ISIZE/2 integers
// Doing it this way reduces CPU loading
try {
while (total<ISIZE) {
count=audioMixer.line.read(buffer,0,I... |
e1f3795f-e2bd-42c7-8d9a-e479d9f5661a | 2 | private void centerMouse() {
if (robot != null && component.isShowing()) {
// Because the convertPointToScreen method
// changes the object, make a copy!
Point copy = new Point(center.x, center.y);
SwingUtilities.convertPointToScreen(copy, component);
robot.mouseMove(copy.x, copy.y);
}
} |
ebac1340-08e8-40ef-a39b-00d07c445790 | 7 | public double minDataDLIfDeleted(int index, double expFPRate,
boolean checkErr){
//System.out.println("!!!Enter without: ");
double[] rulesetStat = new double[6]; // Stats of ruleset if deleted
int more = m_Ruleset.size() - 1 - index; // How many rules after?
FastVector indexPlus = new FastVector... |
25d1c950-84d0-4c10-a606-581f6587a1bf | 7 | public void plotTrainingScrawl(File trainFile)
{
theNet.clearTrainingData();
loadTrainingData(trainFile);
DisplayGraph[] dispGraph = new DisplayGraph[CypherType.size()];
for (int i = 0; i< dispGraph.length; i++)
{
dispGraph[i] = new DisplayGraph(CypherType.fromIntToString(i) + " : Scrawl Plot");
}
... |
d5de980f-5d82-4e45-ae2a-76994b034aa6 | 8 | public List<Short> getShortList(String path) {
List<?> list = getList(path);
if (list == null) {
return new ArrayList<Short>(0);
}
List<Short> result = new ArrayList<Short>();
for (Object object : list) {
if (object instanceof Short) {
r... |
32208c8e-242f-4baf-bd5d-2820ec647fca | 4 | public void doesCollide(Drawable i, Drawable s, Window w) //Checks if two objects collide. If they do, it runs the doCollide() method in the Drawable i
{
if(i.getX() < s.getX()+s.getWidth()){
if(i.getX()+i.getWidth() > s.getX() )
if(i.getY() < s.getY()+s.getHeight())
if(i.getY()+i.getHeight() > s.getY() )
... |
b28fe2cb-7ea3-4bbc-824f-895c5225ddf7 | 6 | @Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
FightState other = (FightState) obj;
if (!Arrays.deepEquals(atkCnt, other.atkCnt))
return false;
if (spareDamage != other.spareDa... |
c5957e81-0df8-422e-9ae2-e3fc2b40b84a | 8 | public static void main(String[] args) {
Cell[][] spreadsheet = new Cell[8][10];
length = spreadsheet[0].length;
setSpreadsheetToEmpty(spreadsheet);
printSpreadsheet(spreadsheet);
String inputFromUser = inputFromUser();
while (!inputFromUser.equalsIgnoreCase("quit")) {
int indexOfEquals = inputFromUser.... |
b049eeff-93d0-446f-998f-99d8c55f9345 | 2 | public LinkedList<StockPosition> qsort( LinkedList<StockPosition> d, int comparing ) {
if (comparing == 0) // 0 means you are sorting by ticker name
qsHelpTick( 0, d.size()-1, d );
if (comparing == 1) // 1 means compare by quantity of shares held
qsHelpQuant( 0, d.size()-1, d );
return d;
} |
bcf2f92a-7552-459f-aae4-0b357e6874b2 | 7 | private boolean doAction(final String action, final SceneObject obj) {
if(Players.getLocal().getAnimation() == -1 && !Players.getLocal().isMoving()) {
if(obj.getLocation().distanceTo() > 5) {
Walking.walk(obj.getLocation());
} else {
if(!obj.isOnScreen()) {
Camera.turnTo(obj);
} else {
if(... |
46626b5b-7280-4281-952c-f35a98c162a4 | 7 | @Override
public void rightMultiply(Matrix other) {
// TODO Auto-generated method stub
for(int i=0;i<4;i++)
for(int j=0;j<4;j++)
copy[i][j]=0;
for (int i = 0; i < 4; i++) {
for (int j = 0; j < 4; j++) {
for (int k = 0; k < 4; k++) {
copy[i][j]=copy[i][j] + this.get(k, i) * other.get(j, k)... |
eb06c96b-cb7d-4c29-bba9-e0613178bffa | 7 | public static TcpPollResult hostAvailable(String ip) {
int port = 80;
try {
SocketAddress addr = new InetSocketAddress(ip, port);
new Socket().connect(addr, 5000);
return TcpPollResult.CONNECTED;
} catch (UnknownHostException ex) {
return TcpPollR... |
4274814f-d215-4bf9-b151-7f1e5c480374 | 9 | public MenuLevel () {
super();
int i;
int posx;
int posy;
int index;
try {
setImg(ImageIO.read(new File("img/background/menu.jpg")));
} catch (IOException e) {
e.printStackTrace();
}
_title.setBounds(180, 25, 430, 70);
_title.setFont(new Font("Arial", Font.BOLD, 45));
add(_title);
... |
ac7c31ad-dc8b-4a20-841f-04f0f9e2d45a | 5 | public boolean readField(aos.apib.InStream in, aos.apib.Base o,int i) {
if ( i > __field_names.length )
return getBaseClassStreamer().readField( in, o, i - __field_names.length - 1 );
AuthenticationRequest v = (AuthenticationRequest)o;
switch (i) {
case 0:
v.id = in.getInt();
break;
... |
94db769d-fc97-4c74-81b0-f640a87fb90f | 1 | public static ConnectionSingleton getInstance() {
if (instance == null)
instance = new ConnectionSingleton();
return instance;
} |
3feb51e6-9151-48d3-b771-db757a94613e | 4 | public boolean isVariableWLocked(int index) {
for (Transaction t: locks.keySet()) {
ArrayList<Lock> lockListT = locks.get(t);
for (Lock lock: lockListT) {
if(lock.getIndex()==index && lock.isWrite()) {
return true;
}
}
}
return false;
} |
37821dbb-413d-416d-aa9d-ef990934be4f | 7 | private static List<Point[]> mergePolygonPointList(int labelCount, Map<Integer, Integer> mergeLabels, List<List<Point>> polygonPointList){
List<Integer> objectLabel = new LinkedList<Integer>();
for(Integer key : mergeLabels.keySet()) {
// System.out.println(key+"<-->"+mergeLabels.get(key));
if(key.equals(me... |
cb58f7ce-c09f-434b-aa0d-cf585e5b514c | 8 | private List removeAssociatedBends(RadialBond killedBond) {
if (bends.isEmpty())
return null;
List<AngularBond> list = new ArrayList<AngularBond>();
Atom atomOne = killedBond.getAtom1();
Atom atomTwo = killedBond.getAtom2();
synchronized (bends.getSynchronizationLock()) {
for (Iterator i = bends.iterato... |
05b6a7e2-f219-4e9d-86b9-e430f6e6ada6 | 7 | protected void eatCombinationOne() {
int green = 0;
int red = 0;
for (Iterator<Plant> it = plants.iterator(); it.hasNext();) {
Plant pl = it.next();
if (pl.getType() == Plant.GREEN_PLANT && green < 1) {
it.remove();
green++;
}
if (pl.getType() == Plant.RED_PLANT && red < 1) {
it.remove();
... |
ed732402-ea13-4564-831f-43710adba823 | 6 | private void recursion1(int depth, int index, ArrayList<String> result, ArrayList<Character> current) {
//judge
int left = 0;
int right = 0;
String item = "";
for (char c : current) {
if (c == '(') {
left++;
} else {
right+... |
c746aaad-2a22-43cd-89ed-b9da54d232c4 | 2 | public boolean mineTile(){
if(resources > 0){
resources--;
if(resources == 0){
Debug.game(tileType + " tile is depleted of resources and became a grass-tile.");
tileType = TileType.GRASS;
id = "G";
// TODO: it may be of interest later to *Tiles-- and grassTiles++.
// Doesn't seem particularly impor... |
99acb55e-6ee5-4f80-b1a7-03c4a330002c | 6 | public TableCellRenderer getCellRenderer(int row, int column) {
TableCellRenderer renderer = (TableCellRenderer) renderers.get(getKey(row, column));
if (renderer == null) {
// no renderer specified for the cell, checking if specified for the column...
renderer = (TableCellRendere... |
7af5106f-c991-412e-8c7e-c7a612ebb311 | 3 | synchronized String getLine() {
// Write the code that implements this method ...
try {
while (available == 0) wait();
} catch (InterruptedException exc) {
throw new RTError("Buffer.putLine interrupted: "+exc);
}
String value = buffData[nextToGet];
if (... |
ab155eb9-0e95-4c57-8de4-e6afd606794d | 7 | @Override public void iterate(){
matcount += 1;
if(matcount >= mat){matcount = 0;
calculate(); }
if(ages){ if(active){ if(age == 0){age = 1;} else{age += 1;}}else{ age = 0;}
if(fades){ if( age >= fade){ purgeState(); age = 0;}}
if( age > 1023){ age = 1023; } state = agify(age);}
//else{... |
0cd4472b-5181-4d8a-a12c-2934650f5a0f | 2 | public static void exportSequenceAsSpreadSheet(SegmentedImage[] images, String oName){
Workbook wb = new HSSFWorkbook();
for(SegmentedImage image : images){
dumpImageToSheet(image, wb);
}
try{
FileOutputStream out = new FileOutputStream(oName + ".xls");
wb.write(out);
out.close();
} catch (E... |
f7e18f08-51fb-4e9d-a5b1-cd1c0848fe8a | 7 | private void setupSelectionGL() {
float xoff = this.getX();
float yoff = this.getY();
List<VertexData> ret = new LinkedList<VertexData>();
this.scalingConst = this.fontSize / this.font.getHeight("A");
int aqc = 0;
for(int i = 0; i < this.selectionEnd; i++)
{
String c = this.actualText.substri... |
527ac0ff-a386-4138-b064-7d39654514b4 | 2 | @Override
public TestResult test(Double input, Double... args) {
double minValue = args[0];
double maxValue = args[1];
boolean passed = (input >= minValue && input <= maxValue);
String message = passed ? null : String.format(messageT,minValue,maxValue);
return new TestResult(... |
272f7ed4-09fa-4def-9deb-64570bb4b088 | 1 | protected void receiveMessageData(IRemoteCallObjectMetaData meta, IRemoteCallObjectData data)
throws Exception {
if (!meta.getExecCommand().equalsIgnoreCase(ISession.KEEPALIVE_MESSAGE)) {
ConnectionInfo info = new ConnectionInfo(
this.idConnection,
... |
ff414a5a-5e8d-47c6-a6ac-6614717dcc5c | 4 | public JSONObject toJSONObject(JSONArray names) throws JSONException {
if (names == null || names.length() == 0 || this.length() == 0) {
return null;
}
JSONObject jo = new JSONObject();
for (int i = 0; i < names.length(); i += 1) {
jo.put(names.getString(i), this.... |
db4b8e09-6745-4a8a-8e1e-a62d2047c31d | 4 | public int min(int hori, int verti, int dia) {
if (hori <= verti && hori <= dia) {
return hori;
} else if (verti <= hori && verti <= dia) {
return verti;
} else {
return dia;
}
} |
9039bb6b-ad13-41d4-b8bb-7fd71a5a37a5 | 6 | public void draw(){
BufferStrategy bs = getBufferStrategy();
if(bs == null){
createBufferStrategy(3);
return;
}
Graphics2D g = (Graphics2D) bs.getDrawGraphics();
//
g.setColor(Color.DARK_GRAY);
g.fillRect(0, 0, dim.width, dim.height);
if(kh.isPicureOn())
g.drawImage(image, 0, 0, dim.width, ... |
b4ba4a6f-33ac-4068-b936-6b1912ac4f55 | 1 | private static void updateFPS()
{
if (Time.getTime() - lastFPS > 1000)
{
System.out.println("FPS: " + fps);
fps = 0;
lastFPS += 1000;
}
fps++;
} |
5365f9e3-2aec-400c-856b-d48980cd8c48 | 3 | private static void sort(int[] array) {
for (int i = 1; i < array.length; i++) {
for (int j = 0; j < array.length - i; j++) {
if (array[j] < array[j + 1]) {
array[j] = array[j] ^ array[j + 1];
array[j + 1] = array[j] ^ array[j + 1];
... |
25e6151d-2d1d-45e1-beed-bc0dc07c6449 | 9 | public static Set<String> addTwoChar( String word ){
//check permission
if( word.length() < ADD_TWO_ACCESSIBLE ) return new HashSet<String>();
word = word.toLowerCase();
StringBuilder processBuilder = new StringBuilder( word );
int wordLength = processBuilder.length();
Set<String> returnList = new Ha... |
d477094a-f14e-4f4a-8d6b-ede28fd105ce | 0 | public JTextField[] getTextFields() {
return textFields;
} |
201f44fd-c8a7-4b15-883a-29c67aa829e7 | 0 | public Profile(){
emptyString = lambda;
transTuringFinal = false;
transTuringFinalCheckBox = new JCheckBoxMenuItem("Enable Transitions From Turing Machine Final States");
transTuringFinalCheckBox.setSelected(transTuringFinal);
transTuringFinalCheckBox.addActionListener(new ActionListener() {
... |
bb15f88b-7644-447e-a8d6-245a6ca13d02 | 7 | @Override
public void keyPressed(KeyEvent flecha){
if(flecha.getKeyCode()==39){
if(posX==670){
posX = 670;
contador += 1;
}else{
posX = posX + 160;
contador += 1;
}
} else if(flecha.getKeyCode()==37... |
089c25a5-4974-432a-9233-f28873d6a5fa | 3 | public void Print(boolean result, int ActiveTO, int sequence, boolean active,int TIME)
{
if(active)
{
if(result)
System.out.println("Time: "+ TIME +" Attempting Bus: "+ (ActiveTO+1) +" Set -> ACTIVE Packet: "+sequence);
else{
... |
f40c44e3-198b-4622-ac05-897e8d0789ec | 3 | public void saveGraph(File file) {
BufferedImage image = new BufferedImage(
contents.getWidth(),
contents.getHeight(),
BufferedImage.TYPE_INT_RGB
);
Graphics2D g = image.createGraphics();
g.setColor(Color.WHITE);
g.fillRect(0, 0, contents.getWidth(), contents.getHeight());
Statistics.drawGraph(g... |
81e4debe-9a8f-4991-9ab5-16f3461f8664 | 3 | public Dimension getPreferredSize(JComponent c) {
String tipText = ((JToolTip) c).getTipText();
if (tipText == null)
return new Dimension(0, 0);
textArea = new JTextArea(tipText);
rendererPane.removeAll();
rendererPane.add(textArea);
textArea.setWrapStyleWord(true);
int width = ((JMultiLineToolTip) c).... |
9d711bcc-799a-40b9-8db2-d3f45e5b2634 | 8 | private void send(byte[] contents) throws IOException
{
checkOpen();
try
{
byte cs = checksum(contents);
/* SOP */
tx.write((byte)0x0f);
tx.write((byte)0x0f);
/* send bytes, escape if needed */
for (byte b : contents)
{
if (b == 0x0f || b == 0x05 || b == 0x04)
{
tx.wr... |
3cd4a984-8882-408e-98e6-d067aebb8f23 | 7 | public void select() {
Connection conn = null;
PreparedStatement pstmt = null;
ResultSet rs = null;
try {
//1、加载驱动
Class.forName("com.mysql.jdbc.Driver");
String url ="jdbc:mysql://localhost:3306/rock";
//2、建立连接
conn = DriverManager.getConnection(url,"root","123456");
String sql = "select * ... |
37042d58-3c01-4eda-a40b-d2315802afa1 | 8 | public boolean attack(int destx, int desty, boolean returnfire) {
//Disables the ability to attack when a unit has already moved positions.
if ((x != oldx && y != oldy) && !MoveAndShoot) {return false;}
units.Base target = FindTarget(destx, desty, true, false);
if (target!=null) {
if (inrange(target.x, targ... |
a42494ac-630b-4b3b-9bf9-16e3d86efe1e | 5 | public BigDecimal variance_as_BigDecimal() {
boolean hold = Stat.nFactorOptionS;
if (nFactorReset) {
if (nFactorOptionI) {
Stat.nFactorOptionS = true;
} else {
Stat.nFactorOptionS = false;
}
}
BigDecimal variance = BigDecimal.ZERO;
switch (type) {
case 1:
case 12:
BigDecimal[] bd = thi... |
a5787b8a-d087-445d-b0c4-f18946c73312 | 9 | public void propagateBackNNA(Bin tst) throws IOException{
double sum = 0;
int i = 0;
Elem tek;
if(tst==bins[0]){
constructNet(bins[1].binHead);
tek = bins[1].binHead;
i=1;
}
else {
updateNet(bins[0].binHead);
tek = bins[0].binHead;
} //updateNet instead of updateIO in order to reset out... |
ee9c78b1-3cab-4833-91b4-03f2be009415 | 7 | public static String averageTimeZone(ArrayList<Kill> Kills) {
String result;
int[] quartile = new int[3];
int[] hours = new int[24];
int total = 0;
for (Kill k : Kills) {
hours[k.getKillTime().get(Calendar.HOUR_OF_DAY)]++;
}
int[] min = new int[] { 0, hours[0] };
for (int i = 0; i < 24; i++) {
... |
a832b2ef-b9b6-410e-9a0f-899feb2fc16a | 4 | public BinaryNode search(int key) {
BinaryNode result = null;
if (left != null && key < elementNumber) {
result = left.search(key);
} else if (right != null && key > elementNumber) {
result = right.search(key);
} else {
result = this;
}
... |
25141a19-8971-477a-840a-8109f6d64c0a | 1 | public Hunter(HuntField field) {
this.alive = true;
this.type = 'H';
this.hunted = 0;
this.field = field;
synchronized (field) {
this.position = new Position(random.nextInt(field.getXLength()), random.nextInt(field.getYLength()));
while (field.isOccupied(p... |
1da0be1e-5419-4f18-a1be-4a818cd1e90d | 4 | public boolean registryServer(String address, int id) throws RemoteException
{
/* Was the server registered?
* If something fails it will be set to 'false'
*/
boolean registered = true;
//New server
InterfaceReplicacao newserver = null;
//Looking for the new server
try
{
newserver = (Interfac... |
47eb315d-6eb2-4cd0-84e5-69414677ad24 | 0 | public void setId(String value) {
this.id = value;
} |
778c2d68-aca9-416f-b390-f44126cd1c30 | 8 | public Set<Map.Entry<Short,Double>> entrySet() {
return new AbstractSet<Map.Entry<Short,Double>>() {
public int size() {
return _map.size();
}
public boolean isEmpty() {
return TShortDoubleMapDecorator.this.isEmpty();
}
... |
7dcb0c89-5e15-426e-8b2c-8df1c4307d5f | 5 | private void implyRotationFrictionToMoments()
{
// If there are no moments, doesn't do anything
if (this.moments.isEmpty())
return;
ArrayList<Point> momentstobeended = new ArrayList<Point>();
// Goes through all the moments
for (Point p: this.moments.keySet())
{
double f = this.moments.get(p);
... |
71facc0c-0160-4ee8-a819-04e6db834d27 | 7 | public void renderImage(int xp, int yp, int[] imagePixels, int Width, int Height, boolean fixed) {
if (fixed) {
xp -= xOffset;
yp -= yOffset;
}
for (int y = 0; y < Height; y++) {
int ya = y + yp;
for (int x = 0;x < Width; x++) {
int xa = x + xp;
if (xa < 0 || xa >= width || ya < 0 || ya >= hei... |
a8499373-d247-43dd-932a-c1198fb066da | 9 | public SoapRequest(Service service, Method method, Object parameters) {
//Set the results node
resultsNode = method.getResultsNodeName();
//Create new http request
request = new javaxt.http.Request(service.getURL());
request.setHeader("Content-Type", "text/xml; charset=ut... |
cc886561-e299-4412-905e-804215763a03 | 1 | public ICommand getCommand(HttpServletRequest request) {
String action = request.getParameter("command");
ICommand command = commands.get(ParserType.valueOf(action.toUpperCase()));
if (command == null) {
command = (ICommand) new NotFoundCommand();
}
return command;
... |
27b3c2a8-e7cb-4bff-80f1-0a8fc6fda39a | 7 | @Override
public void publishInterruptibly(long sequence, Sequence lowerCursor)
throws InterruptedException {
int counter = RETRIES;
while (sequence - lowerCursor.get() > pendingPublication.length()) {
if (--counter == 0) {
if (yieldAndCheckInterrupt())
throw new InterruptedExcep... |
f18d741e-48df-407d-81db-feaf1cceacc4 | 6 | public int bestMeleeAtk() {
if(c.playerBonus[0] > c.playerBonus[1] && c.playerBonus[0] > c.playerBonus[2])
return 0;
if(c.playerBonus[1] > c.playerBonus[0] && c.playerBonus[1] > c.playerBonus[2])
return 1;
return c.playerBonus[2] <= c.playerBonus[1] || c.playerBonus[2] <=... |
aeb91ac4-c81c-4d5b-9e7c-e2090c438d26 | 7 | private void addHandlerEdges(final Block block, final Map catchBodies,
final Map labelPos, final Subroutine sub, final Set visited) {
// (pr)
if (visited.contains(block)) {
return;
}
visited.add(block);
final Tree tree = block.tree();
Assert.isTrue(tree != null);
final Iterator hiter = handlers.v... |
f12ab134-d5b5-4cfb-8227-48481c002d2e | 8 | @Override
public ResourceTask nextTask(final int taskId) throws Exception {
lock.lock();
try {
while (true) {
// 1. counting tasks:
final Range numberRange = numberRangeIterator.next();
if (numberRange != null) {
assert (sortingTasksSubmitted == 0);
// compose... |
b1fa4f57-e342-431b-b6d2-c06964dd691a | 1 | public void removeOnetimeLocals() {
block.removeOnetimeLocals();
if (nextByAddr != null)
nextByAddr.removeOnetimeLocals();
} |
94cab36b-ea0a-4a84-a5a0-20a496cf0bf8 | 5 | public void doLexing() {
LexerRule accRule = null;
while (finishIndex < input.length() - 1) {
while (currentState.isAnyAlive()) {
++finishIndex;
LexerRule tmpRule = currentState.getAccepted();
if (tmpRule == null) {
} else {
accRule = tmpRule;
lastIndex = finishIndex - 1;
}
if ... |
25ee86d4-007e-467e-a0b4-ce90f82fb032 | 6 | public String nextCDATA() throws JSONException {
char c;
int i;
StringBuffer sb = new StringBuffer();
for (;;) {
c = next();
if (end()) {
throw syntaxError("Unclosed CDATA");
}
sb.append(c);
i = ... |
f475e10d-1cb1-4d98-ac17-46fc1ebfeadf | 3 | private static void toDescriptor(StringBuffer desc, CtClass type) {
if (type.isArray()) {
desc.append('[');
try {
toDescriptor(desc, type.getComponentType());
}
catch (NotFoundException e) {
desc.append('L');
String ... |
774acab1-ee79-427d-9235-cdc1749b7db5 | 0 | @Override
public void keyReleased(KeyEvent e) {
// TODO Auto-generated method stub
} |
6cc305f7-e5f6-4c43-9d64-e091fb5d7aef | 1 | public long set(long millis, int value) {
long timeOnlyMillis = iChronology.getTimeOnlyMillis(millis);
int[] ymd = iChronology.gjFromMillis(millis);
// First set to start of month...
millis = iChronology.millisFromGJ(ymd[0], value, 1);
// ...and use dayOfMonth field to check rang... |
2fd30b44-4c25-4aa4-9b42-0e94f40086b7 | 3 | public void findMails( ) {
this.ec.clearMails();
File[] path = new File(this.path).listFiles();
for(File f : path) {
if(f.isFile() && f.getName().contains(".eml")) {
EMail e = new EMail();
e.setFileName(f.getName());
e.parseMail(this.path, f.getName());
e.setId(this.ec.getNewId());
this.ec.... |
d4bba0d8-5594-4371-ac8f-71de7bc1087e | 4 | @Override
public String prefix_toString(){
int count = 0;
String representation = "";
if(children.length != 0 && count/2 <= children.length){
representation += children[count].prefix_toString();
count++;
}
representation += root.name+ " ";
if(children.length != 0 && count/2 > children.length){
rep... |
e96d7518-4168-4f24-a3a3-d02d54617c9b | 9 | public static void main(String[] args) {
if (args.length != 2) {
System.out.println("THERE WAS AN ERROR WITH THE INPUTS");
return;
}
String tfile = ""; // .torrent file to be loaded
String sfile = ""; // name of the file to save the data to
for (int i = 0; i < args.length; i++) {
if (i == 0) {
... |
31b9b4ed-042b-4b6c-80ca-2fdb422c304e | 3 | private void CreateCourse() {
//these will help set and control logic for courese
points = new int[4];
passedPoint = new boolean[4];
passedPointLoc = new int[4];
for (int i = 0; i < points.length; i++) {
points[i] = random.nextInt(1500 + 200);
pa... |
48e8f327-7175-4914-8c2a-04a4eb9161be | 7 | public boolean moveable(Game game, Piece piece, Square targetSquare) {
Chess chess = game.getChess();
Square square = piece.getCurrent();
Piece targetPiece = chess.locatePiece(targetSquare);
//
if (chess.isLeapOver(piece.getCurrent(), targetSquare)) {
return false;
... |
20c7b55e-165b-43be-8af4-29ebe3b6716b | 5 | public void addBan(String pname) {
try {
String[] banList = plugin.getBans();
ArrayList<String> arraylist = new ArrayList<String>();
for (String p : banList) {
if (p != pname) {
arraylist.add(p);
}
}
new File(plugin.getDataFolder() + File.separator + "bans.txt")
.createNewFile();
F... |
f6439f43-bed1-4929-906c-5e4fc94bdc03 | 8 | public static void main(String[] args) {
if (args.length == 0) {
System.err.println("Please provide a text file name");
System.exit(1);
}
String fileName = args[0].toString();
int count = DEFAULT_COUNT;
if (args.length > 1) {
try {
count = Integer.parseInt(args[1]);
} catch (NumberFormatExce... |
a5a75e7a-16d9-440b-aa5f-eeca052846de | 0 | public static SharedTorrent fromFile(File source, File destDir)
throws IllegalArgumentException, IOException {
FileInputStream fis = new FileInputStream(source);
byte[] data = new byte[(int)source.length()];
fis.read(data);
fis.close();
return new SharedTorrent(data, destDir);
} |
8e9ef5f1-6cd9-4095-a532-249dfbb12596 | 2 | @Override
public void map(LongWritable key, Text value, Context context)
throws IOException, InterruptedException {
String line = value.toString();
String [] movieInfoStrings = line.split("%%%");
assert(movieInfoStrings.length==3);
int year=0;
try {
year= Integer.parseI... |
0acbdc38-f658-4896-a6d4-c5914db59ebd | 9 | public ConnectionThread(final int id, final Socket socket)
{
ID = id;
try
{
bReader = new BufferedReader(new InputStreamReader(socket.getInputStream()));
pWriter = new PrintWriter(socket.getOutputStream(), true);
}
catch(Exception e) { e.printStackTrace(); }
thread = new Thread()
{
@Override
... |
ce0d939b-a367-4e42-9752-f13222c3f7b3 | 3 | public boolean calculate() {
//nope, actually change it
if (seqChange.isSnp()) setSNP();
if (seqChange.isIns()) setINS();
if (seqChange.isDel()) setDEL();
return this.transcriptChange();
} |
31bf46c1-9fad-4567-8220-7d25136dff1d | 8 | public Frame9() {
try{
Class.forName(JDBC_DRIVER);
conn = DriverManager.getConnection(DB_URL,USER, PASS);
statement = conn.createStatement();
}catch(SQLException se){
se.printStackTrace();
}catch(Exception e){
e.printStackTrace();
}
setTitle("Blok D, 1 - 33 ; 68 - 73");
setDefaultCloseOpe... |
e2d85bea-25aa-4e90-a113-c34a567a6318 | 0 | public UnknownExcelReport1(File file) {
super(file);
} |
ce4d04f3-557c-491f-99b8-99aed642a642 | 8 | private void JTreeContaMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_JTreeContaMouseClicked
DefaultMutableTreeNode node = (DefaultMutableTreeNode) JTreeConta.getLastSelectedPathComponent();
if (node == null){
return;
}
else{
if (this.op... |
ad29b049-a4a4-4cdb-a038-dc36acc0d5cb | 8 | @Override
public boolean addCommand(CommandBase command)
{
CommandDescriptor descriptor = command.getDescriptor();
if (!(descriptor instanceof Dispatchable))
{
throw new IllegalArgumentException("The given command is not dispatchable");
}
// Remove command f... |
a66f9f24-2b0d-47ee-8b70-ae2fe6d102ee | 1 | public List<Double> getColumn() {
if (column == null) {
column = new ArrayList<Double>();
}
return this.column;
} |
08201688-409c-4821-8d9b-524c9d321fcb | 4 | @Override
public void paintComponent(Graphics g) {
super.paintComponent(g);
Graphics2D g2 = (Graphics2D) g;
for (int y = 0; y < Board.getHeight(); ++y ) {
for (int x = 0; x < Board.getWidth(); ++x) {
g2.setColor(board.getBackgroundColor());
g2.fill... |
70662ca4-dae5-45fe-9779-93631623d3f4 | 2 | public List<Administrateur> ListerAdministrateurs() {
try {
String sql = "SELECT * FROM User WHERE role='Administrateur'";
ResultSet rs = crud.exeRead(sql);
List<Administrateur> liste = new ArrayList<Administrateur>();
while (rs.next()) {
Administr... |
2e28b39d-1599-448d-93be-678cefaa459e | 9 | public VOCheckIndex checkIndex(VOBackupIndex backupIndex,
final boolean checkExistsFile,
final boolean checkFileCheckSum) {
VOCheckIndex result = new VOCheckIndex();
if (CollectionUtils.isNotEmpty(backupIndex.getBackupFileList())) {
... |
53ee6f74-8674-4ac0-82ac-b8b7afc9e6c8 | 0 | public boolean areTherePriceForQuantity (int productPackQuantity) {
return prices.containsKey(productPackQuantity);
} |
5baaeb75-5148-4125-a9a1-fdf10f2fe279 | 7 | public boolean equals(Object _other)
{
if (_other == null) {
return false;
}
if (_other == this) {
return true;
}
if (!(_other instanceof UserPk)) {
return false;
}
final UserPk _cast = (UserPk) _other;
if (id != _cast.id) {
return false;
}
if (email == null ? _cast.email !=... |
1747e6b5-3393-406b-8361-cac7c936ce55 | 2 | private int getItemIndexByElementName(String elementName) {
int result = -1;
Item [] items = tree.getItems();
for(int i = 0; i < items.length; i++) {
if(items[i].getText().equals(elementName)) {
return i;
}
}
return result;
} |
9c2f8a53-cb70-4fb0-9b42-ae81b5f6959f | 0 | public String getImportFileFormat() {
return (String) importFormatComboBox.getSelectedItem();
} |
5fadbf8d-66a8-47cb-862d-a0d54c25faaa | 1 | @Override
public String prepareConsoleMessage(int type, String msg, Throwable throwable) {
StringWriter stackTrace = new StringWriter();
if (throwable != null) {
throwable.printStackTrace(new PrintWriter(stackTrace));
}
return (Logger.MSG_TYPE_STRING[type] + ": " + msg + stackTrace.toString());
} |
c9cc27f9-c167-40da-8881-23e30838e636 | 1 | public static NoteEditorFrame getInstance(){
if (instance == null){
instance = new NoteEditorFrame();
}
return instance;
} |
324b8e57-2ad3-4032-82ff-5c8c449a0b7c | 9 | public Project2_Move_Thompson getRandomMove(int RANDOMIZATION_ALGORITHM)
{
//Create a list to hold all of our pieces.
java.util.ArrayList<Integer> pieces = new java.util.ArrayList<Integer>();
//Find all our pieces
for(int i = 0; i < 64; i++)
{
if(color[i] ==DARK)
{
pieces... |
15e2f7b5-8dc5-4ac3-bdc7-46c455c064b5 | 5 | private synchronized void integrate() { //в этом методе движок расчитывает, как взаимодействуют объекты
for (PhysicalBody physBody : physBodies.values()) {
Vector3d resultForce = new Vector3d();
for (ForceField forceField : forceFields.values()) {
Vector3d anotherForce = forceField.forceForPhysicalBo... |
a40eacfb-11be-4e6a-85c5-956db85b189a | 7 | public static void main(String[] args) {
args = getCombinedArgs(args);
String challengerBot = parseStringArgument("bot", args,
"ERROR: Pass a bot with -bot, eg: -bot voidious.Dookious 1.573c");
String challengeFile = parseStringArgument("c", args,
"ERROR: Pass a challenge file with -c, eg: -... |
996d5487-280a-44a5-8a0c-e6114e28d875 | 2 | public void fireModifiedStateChangedEvent(Document doc) {
modifiedStateChangedEvent.setDocument(doc);
for (int i = 0, limit = documentListeners.size(); i < limit; i++) {
((DocumentListener) documentListeners.get(i)).modifiedStateChanged(modifiedStateChangedEvent);
}
for (int i = 0, limit = outlinerDocumentLi... |
2b36d6df-4518-49b8-8033-989704a58f85 | 0 | private void createFht() {
fht = new FastHashTable<Integer,Short>(N,M,K,W,WORD,BITS);
table = new Hashtable<Integer,Short>(N);
} |
7396d95f-1f24-4d3d-81c3-4df4de2182a6 | 8 | public List<Person> getFriendsList(String accessToken) throws OAuthError {
String basicInfoUrl = Constants.FB_FRIENDS_LIST_URI;
List<Person> personList = new ArrayList<Person>();
try {
String charset = "UTF-8";
List<NameValuePair> params = new ArrayList<NameValuePair>();
params.add(new BasicNameValuePa... |
8186f41a-d600-4f24-bdb5-0af7c3b8875b | 3 | @WebMethod(operationName = "ReadUser")
public ArrayList<User> ReadUser(@WebParam(name = "user_id") String user_id) {
User user = new User();
ArrayList<User> users = new ArrayList<User>();
ArrayList<QueryCriteria> qc = new ArrayList<QueryCriteria>();
if(!user_id.equal... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.