method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
e19abda3-f90e-474d-a9f2-268873c696dc | 7 | @Override
public void setMiscText(String text)
{
if(affected instanceof MOB)
{
final MOB M=(MOB)affected;
final List<String> V=CMParms.parseSemicolons(text,true);
for(int v=0;v<V.size();v++)
{
String s=V.get(v);
Tattooable T=M;
if(s.toLowerCase().startsWith("account ")
&&(M.playerStats... |
928c667a-e9c9-4915-99ad-bf6f2d409643 | 7 | @SuppressWarnings("unchecked")
synchronized void setStatusChanged(String statusName, int intInfo, Object statusInfo, boolean isReplace) {
if (!allowStatusReporting || statusList != "all" && statusList.indexOf(statusName) < 0)
return;
statusPtr++;
Vector statusRecordSet;
Vector msgRecord = new Vector();
ms... |
0d1cf572-91d1-4cee-b899-7c7c3c198982 | 3 | private void testScaling(String set) throws UnknownHostException {
File testset = new File("testsets/" + set + "/");
File[] filelist = testset.listFiles();
ArrayList<String> files = new ArrayList<String>();
for (File f : filelist) {
files.add(f.getAbsolutePath());
}
for (int i = 0; i < 20; i++) {
s.r... |
01fe11c0-b4b5-48f3-9aa2-ac6b702561bd | 5 | public void setPriorMap(HashMap<String, Double> priorMap) throws LangDetectException {
this.priorMap = new double[langlist.size()];
double sump = 0;
for (int i=0;i<this.priorMap.length;++i) {
String lang = langlist.get(i);
if (priorMap.containsKey(lang)) {
... |
bb9ca9d6-92d0-4eac-aa85-bf9c59139042 | 2 | @Override
public void damage(int damage, IDamageSource source) {
if(this instanceof IArmored) {
((IArmored)this).damageArmor(damage);
this.health-=(int)Math.floor(((IArmored)this).getProtection()*damage);
} else {
this.health -= damage;
}
if(this.health <=0f) {
this.kill(source);
}
} |
5f040d7b-bcad-423b-9731-6dce3734215c | 9 | void proteinShape(int shapeType) throws ScriptException {
short mad = 0;
// token has ondefault1
int tok = statement[1].tok;
switch (tok) {
case Token.on:
mad = -1; // means take default
break;
case Token.off:
break;
case Token.structure:
mad = -2;
break;
case Token.temperature:
// MTH... |
32161d5d-5181-419e-bfa7-aeac68c23102 | 8 | @Override
public void keyPressed(KeyEvent e) {
if (e.getKeyCode() == KeyEvent.VK_RIGHT) {
if (heroCurrentX < 450) {
heroCurrentX += 4;
} else {
heroCurrentX += 0;
}
} else {
if (e.getKeyCode() == KeyEvent.VK_LEF... |
5b27cc02-a5af-478a-af3b-e335db5d2336 | 6 | public int postSentence(SentenceSpan span) {
int dim = tv.startColumn();
current = dim;
if (sentenceList != null) {
sentenceList.add(span);
if (sentenceList.size() - 1 != dim) {
throw new IllegalStateException();
}
}
if (spanLists != null) {
if (spanLists.size() == di... |
d4143e62-63de-442f-a638-d12ebf53f4cf | 6 | private void initialize() {
Cigar cig = read.getCigar();
if (cig.getCigarElements().size()==0) {
System.err.println("No cigar elements for read: " + read.toString() + ", skipping, mq is : " + read.getMappingQuality() );
initialized = true;
return;
}
CigarElement firstEl = cig.getCigarElement(0);
... |
e92d0a71-0c8b-4388-8f6f-dbf01f3f90f0 | 1 | public static final boolean isUnix() {
return isMacintosh() || isLinux();
} |
63b79f6d-f283-41a3-80a9-9c356e950e8a | 1 | public void tick()
{
if (level != null)
level.tick(gc.input);
} |
0e7b1b5a-7d4b-4d59-900d-39dd156f0717 | 6 | public String addBinary(String a, String b) {
int ia = a.length() - 1;
int ib = b.length() - 1;
if (ia < 0)
return b;
if (ib < 0)
return a;
char[] sb = new char[Math.max(ia, ib) + 1];
int sbIndex = sb.length - 1;
int carry = 0;
w... |
ebb85faa-0af4-4e41-8c4f-311db18163bd | 3 | private Object handleDesi(Object tos, String ref) {
if (tos instanceof Person && ((Person)tos).getDescendantInterestSubmitterRef() == null && ref != null) {
((Person)tos).setDescendantInterestSubmitterRef(ref);
return new FieldRef(tos, "DescendantInterestSubmitterRef");
}
return null... |
b6f1e8e4-bc6f-49c0-8ade-cfeca44abe29 | 9 | public void _195() {
if(C.KREG==5) { _96(); return; }
if(C.NFIL==1) { _198(); return; }
if(C.DHH<0.000001) C.DH=0.0;
if(C.DHH<0.00001) { _96(); return; }
if(C.KIT>4==Math.abs(C.DH-C.DHH)<0.01) { _96(); return; }
if(Math.abs(C.DH-C.DHH)/C.DHH*100<C.ERR) { _96(); return; }
... |
6e475519-ae51-45bb-8f2c-bbee2d683a9a | 4 | public static void UpperPublisher(){
try {
if(conn == null || conn.isClosed()){
conn = DatabaseConnection.getConnection();
}
} catch (SQLException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
try{
conn.setAutoCommit(false);
PreparedStatement s... |
63eedb13-8b78-4be6-9557-cf79d3d0d854 | 2 | public void back() throws JSONException {
if (this.usePrevious || this.index <= 0) {
throw new JSONException("Stepping back two steps is not supported");
}
this.index -= 1;
this.character -= 1;
this.usePrevious = true;
this.eof = false;
} |
0a07ac1f-8ed8-45d2-b0d7-b34ac9909d44 | 0 | public static void main(String[] args) {
System.out.println(Float.MIN_VALUE); // 1.4E-45
System.out.println(Float.MAX_VALUE); // 3.4028235E38
System.out.println(Double.MIN_VALUE); // 4.9E-324
System.out.println(Double.MAX_VALUE); // 1.7976931348623157E308
} |
3e880970-1e40-4da4-b829-e5054cbb91a8 | 9 | @Override
protected void createEffect( NormalSpaceObject object, int delta ) {
Shape shape = ((SpaceObject)object).getShape();
Speed currentSpeed = object.getMotion().speed;
Float currentDirection = (float) currentSpeed.getDirection().getTheta();
if( currentSpeed.getValue() == 0 ) {
return;
}
if(... |
5a2a7259-f9d3-43ee-b059-982828743fa5 | 3 | private Direction chooseRandomDirection() {
int n = rand.nextInt(4);
switch(n) {
case 0: return Direction.LEFT;
case 1: return Direction.RIGHT;
case 2: return Direction.UP;
default: return Direction.DOWN;
}
} |
1526c916-f659-4e90-8933-ced3687457b2 | 8 | public void nextPermutation(int[] num) {
boolean found = false;
int k = 0;
int l = 0;
if (num.length == 0 || num.length == 1) {
return;
}
for (int i = num.length - 2; i >= 0; i--) {
if (num[i] < num[i + 1]) {
found = true;
k = i;
break;
}
}
if (found == false) {// not found, the p... |
08e8c28d-1ff3-486e-af1a-7ba43b2fcbcf | 8 | public boolean displayModesMatch(DisplayMode m1, DisplayMode m2){
if(m1.getWidth() != m2.getWidth() ||
m1.getHeight() != m2.getHeight()){
return false;
}
if(m1.getBitDepth() != DisplayMode.BIT_DEPTH_MULTI &&
m2.getBitDepth() != DisplayMode.BIT_DEPTH_MULTI &&
m1.getBitDepth() != m2.getBitDe... |
e0f0e9e2-56d1-4adf-a191-a19dc5bda108 | 7 | public void loseLife()
{
if(!Game.getInstance().getGodMode()){
if (Game.getInstance().getGameTime() < nextHurt){
return;
}
setLives(getLives() - 1);
new AePlayWave("se_pldead00.wav").start();
/* Add respawn protection to prevent diei... |
ec2cb12f-7a6b-43c5-b714-ad0f698f14ac | 3 | @Override
public void run() {
synchronized(numberOfActiveProducerLocks){
numberOfRunningProducers++;
}
try{
Random rnd= new Random();
for(int i=0 ; i<totalNumberOfItemsToProduce ; i++){
//Check if queue is already full
if(schedul... |
98b97cc1-d4c3-46cd-8a6d-cd529d3bf90a | 9 | @Override
public Object put( String key , Object v ){
if ( key == null )
throw new RuntimeException( "key should never be null" );
else if ( key.equals( "_id" ) )
_id = v;
else if ( key.equals( "filename" ) )
_filename = v == null ? null : v.toString();
... |
5f908e8c-25da-43dd-8930-c46594be8a23 | 0 | public World(int width, int height, int[][] blockSheet) {
this.width = width;
this.height = height;
this.blockSheet = blockSheet;
} |
c2916041-7ee6-4041-b996-d4fc6595ba27 | 2 | public void Throttle (double value){
value = (value > 1) ? 1 : value;
value = (value < -1) ? -1 : value;
toucan.SetJaguar(nodeId, (short) (value * 0x7FFF));
} |
0a96c9a7-a87b-42aa-9f5f-68542f104223 | 6 | @Override
public Object getValueAt(int rowIndex, int columnIndex) {
StockMarketYear currentYear = market.getYearOffset(rowIndex);
switch (columnIndex) {
case 0: return currentYear.year();
case 1: return currentYear.startingBalance();
case 2: return currentYear.sta... |
37ec12b3-f743-4adb-93f8-e83f704188e4 | 9 | @Override
public boolean tick(Tickable ticking, int tickID)
{
if(!super.tick(ticking, tickID))
return false;
if(affected instanceof MOB)
{
final MOB M=(MOB)affected;
if((M.riding()!=null)
&& (M.riding() != lastRider)
&& (M.riding() instanceof MOB))
{
lastRider=M.riding();
final Room R=... |
c274666a-666a-4c0a-950c-febcacb2de6f | 9 | @Override
public void messageReceived(ChannelHandlerContext ctx, MessageEvent event) throws Exception {
if (!(event.getMessage() instanceof Frame)) {
LOGGER.error("Not a frame... {}", event.getMessage());
return;
}
Channel channel = ctx.getChannel();
Frame frame = (Frame) event.getMessage();
LOGGER.tra... |
9c8d14b9-5b99-4525-88c1-f53426361f07 | 0 | public List<Account> getAccounts() {
return this.accounts;
} |
2594768f-429a-4679-aa43-b30fe5fe57a3 | 5 | public int getThickness(int t) {
int thickness = 1;
switch (t) {
case 0:
thickness = 1;
break;
case 1:
thickness = 4;
break;
case 2:
thickness = 6;
break;
case... |
521389da-21d8-4aa8-9036-210d404e839e | 2 | public int[][] quant(int array[][]) {
for (int i = 0; i < SIZE; i++) {
for (int j = 0; j < SIZE; j++) {
array[i][j] = round((array[i][j] * tableQuant[i][j]));
}
}
return array;
} |
2c52cbeb-52ff-450a-b380-42d152a7c213 | 9 | private int dfs(int[][] matrix, int[][] scoreBoard,
boolean[][] visiting,
int startX, int startY ){
int currentValue = matrix[startX][startY];
visiting[startX][startY] = true;
int maxLength=1;
for (int i=0; i<dx.length; i++){
int nex... |
31fc4614-1441-417f-a459-2e69edf3b7e3 | 6 | public void showBankAccounts(CommandSender player, String name)
{
List<BankAccount> Accounts = null;
boolean self = Misc.isSelf(player, name);
if (!iConomy.hasAccount(name)) {
Messaging.send(this.Template.parse("error.account", new String[] { "+name,+n" }, new String[] { name }));
retu... |
8fe5617e-0937-4352-81e5-46f063241f36 | 5 | protected TerminalSize waitForTerminalSizeReport(int timeoutMs) {
long startTime = System.currentTimeMillis();
synchronized(readMutex) {
while(System.currentTimeMillis() - startTime < timeoutMs) {
Key key = inputDecoder.getNextCharacter();
if(key == null) {
... |
7b7f6015-ed50-44c4-bb22-5e99bf4bd15d | 2 | private void lbFilesMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_lbFilesMouseClicked
if (evt.isPopupTrigger() && adminPopup.isEnabled()) {
lbFiles.setSelectedIndex(lbFiles.locationToIndex(evt.getPoint()));
adminPopup.show(lbFiles, evt.getX(), evt.getY());
}
... |
4d04223f-d0b1-4c11-ab75-49cca9ecc271 | 2 | public void uimsg(String msg, Object... args) {
if (msg == "pack") {
pack();
} else if (msg == "dt") {
dt = (Integer) args[0] != 0;
} else {
super.uimsg(msg, args);
}
} |
bf4c380a-129d-4f65-b427-c87d3634de4e | 7 | public SpeaPopulation(Genome comp)
{
individual = new ArrayList<Genome>();
archive = new ArrayList<Genome>();
parent = comp;
// reading parameters
Parameter param = Parameter.getInstance();
String paramval;
paramval = param.getParam("population size");
if (paramval != null)
size = Intege... |
ea527d67-a404-4d02-aee7-73a14a08a7dc | 5 | public static byte[] readRawHeaderLine(InputStream inputStream) throws IOException {
ByteArrayOutputStream buf = new ByteArrayOutputStream();
int ch;
int lastCh=0;
try{
while ((ch = inputStream.read()) >= 0) {
buf.write(ch);
if (ch == '\n' && las... |
742934c3-a468-4f01-a935-2ebb4433c105 | 6 | private static final String pad(String str, char ch, int maxLength, boolean left) {
if (str == null)
return "";
if (maxLength < 1)
throw new IllegalArgumentException("指定位数不能小于1!");
int length = str.length();
if (maxLength > length) {
int diffSize = maxLength - length;
char[] chars = new char[maxLeng... |
4c3347b8-29e1-4ac2-9eba-ad8aa05a8321 | 1 | private JLabel getJLabel1() {
if (jLabel1 == null) {
jLabel1 = new JLabel();
jLabel1.setText("Please choose you operation !");
}
return jLabel1;
} |
279d7131-ed78-4751-b76a-ac3f161cfd0f | 7 | void checkCommands1()
{
int i;
LivingThing thnStore;
String strStore=null;
for (i=0;i<vctSide1.size();i++)
{
thnStore = (LivingThing)vctSide1.elementAt(i);
if (!thnStore.vctCommands.isEmpty())
{
strStore = (String)thnStore.vctCommands.elementAt(0);
thnStore.vctCommands.removeElementAt(0);
... |
31b9760b-211f-457b-9dae-a13f4c6a0dd9 | 8 | public BufferedImage getDitheredImage(BufferedImage image, int colorChannel) {
checkNotNull(image, "Image to be dithered is null!");
int width = image.getWidth();
int height = image.getHeight();
BufferedImage ditheredImage = new BufferedImage(width, height, ColorSpace.TYPE_RGB);
... |
fa95bf33-9393-4992-b535-420d98bf0c89 | 8 | @Override
public int print(Graphics pg, PageFormat pageFormat,
int pageIndex) throws PrinterException {
pg.translate((int)pageFormat.getImageableX(),
(int)pageFormat.getImageableY());
int wPage = 0;
int hPage = 0;
if (pageFormat.getOrientation() == PageFormat.LANDSCAPE) {
wPage = (int)pageFormat.get... |
e5d6e8cd-2771-43f8-87fe-21c95c51c756 | 3 | protected boolean blocked(int x, int y, int[][] board) {
for (Move move : Move.ALL) {
int tox = x + move.dx;
int toy = y + move.dy;
if (!DefaultBestMoveFinder.inside(tox, toy, board.length, board[0].length)) {
continue;
}
if (board[x][y... |
e3dca60b-3b12-4165-8c7a-a8ec27b26b4e | 3 | public void run(){
// Open a server socket because the client should act
// like a server, too
try {
serverSocket = new ServerSocket(port);
} catch (IOException e) {
System.out.println(e);
}
/*
* Create a client socket for ea... |
23d4f9c6-a576-40ea-a71c-22a2f82d93ca | 0 | public boolean isJoint() {
return this.isJoint;
} |
089fdf71-6e7e-46a0-94e4-712ffa400528 | 9 | public static int show(Character c, int pointsAvailable){
Scanner scan1 = new Scanner(System.in);
System.out.println("\nYou have " + pointsAvailable + " points available to spend.");
System.out.println( "(1)[10 points] Heal Potion - Heals health to full.\n" +
"(2)[10 points] Strength Potion - Increases attac... |
243b9210-1042-45f2-8ed8-b25f0676f407 | 2 | void implementCollection()
{
props.add(Defaults.COLLECTION_PROPERTY_COL);
returnTypes.add(Object[].class);
// add a dummy mutator
setters.add(null);
getters.add(null);
if (this.object != null)
{
Object[] contents = ((Collection<?>) object).toArray();
values.add(contents);
}
} |
921e6af4-2dfb-4e7d-a801-4a000b9c2f95 | 4 | public int numInDir(int loc, int direction) {
switch (direction % 4) {
case 0:
return numPiecesUpDiag[(loc / 8) - (loc % 8) + 7];
case 1:
return numPiecesRow[loc % 8];
case 2:
return numPiecesDownDiag[(loc / 8) + (loc % 8)];
case 3:
... |
e605e6a4-aae4-4d39-8c41-4e8caa8ccfee | 4 | private void dbscan() {
for (Point i : points) {
if(isCancelled())
return;
if (i.visited) {
continue;
}
i.visited = true;
pointsClustered++;
setProgress(100*pointsClustered... |
0cdfd1f8-9bee-4e12-837d-17f5267adb65 | 8 | public void setPieces(){
ConnectFourPiece[][] piecesToBeSaved = ConnectFourBoard.getPieces();
for(int j = 0; j < piecesToBeSaved[0].length; j++){
for(int i = 0; i < piecesToBeSaved.length; i++){
if(piecesToBeSaved[i][j].getPieceColour() == Piece.ConnectFourPieceColour.RED){
Element newRedPiece;
... |
2503f1e5-aa90-4141-8ee0-601861dc1dd4 | 6 | private ArrayList<PluginInterface> setPlugins(String cpath) {
ArrayList<PluginInterface> plugins = new ArrayList<PluginInterface>();
try {
File f = new File(cpath);
String[] files = f.list();
//
if (files.length == 0) {
log.error("not exists file in plugins dir.");
return null;
}
for (int ... |
1484c5de-b8f3-4405-a25c-2f81317b5d52 | 8 | private void constructSLS() {
for (int row = 0; row < N; row++) {
for (int col = 0; col < M; col++) {
makeSet(getIndex(row, col));
}
}
for (int row = 0; row < N; row++) {
for (int col = 0; col < M; col++) {
int color = ... |
a8368ce3-f4b8-4005-bc56-a639cab8a360 | 9 | @Test
public void testInvalidSpecificDateInputConstructor() {
String testingName = "Test for invalid specific date input constructor.";
String expectedError = "";
// Test for lower bound of invalid specific month input
try {
new DateAndTime(2014, 0, 30);
} catch (IllegalArgumentException e) {
expected... |
e2ece17c-ddde-4c48-9a1e-943c09a8f7f7 | 9 | private void movePart()
{
if (direction == ConveyorDirections.UP)
{
if (part.getCenterX() > getCenterX())
{
part.setCenterLocation(part.getCenterX() - 1, part.getCenterY());
}
else
{
part.setCenterLocation(part.getCenterX(), part.getCenterY() - 1);
}
}
else if (direction == ConveyorDi... |
4e41125e-d963-408e-bc78-55c3bbde75bb | 0 | private String derivationString() {
StringBuffer sb = new StringBuffer();
return sb.toString();
} |
662bfff8-9a60-40c8-981f-84ec037236fa | 1 | public Card getNextCard() {
if(iterator == cards.size())
return null;
return cards.get(iterator++);
} |
60f46eff-57a6-407a-b90d-79b91471f7b7 | 7 | public static void main(String[] args) {
int target = 200;
int ways = 0;
for (int a = target; a >= 0; a -= 200) {
for (int b = a; b >= 0; b -= 100) {
for (int c = b; c >= 0; c -= 50) {
for (int d = c; d >= 0; d -= 20) {
for (int e = d; e >= 0; e -= 10) {
... |
1d79b14b-04ee-4f5e-a90c-791ebf527dc7 | 5 | public void backToMenu () {
/* uses if and else statements to check what the user would like to do */
int reply = JOptionPane.showConfirmDialog(null, "Would you like to return to the Main Menu?");
if(reply == JOptionPane.YES_OPTION) {
timer.stop();
reply = JOptionPane.showConfirmDialog(null, "Would yo... |
43dbc896-728c-45e9-b16d-aa329a55ca25 | 3 | private String getInstructorString(HashMap<String, Object> map) {
@SuppressWarnings("unchecked")
ArrayList<Object> ids = (ArrayList<Object>) map.get("instructorIds");
if (ids.isEmpty())
return null;
String result = "";
for (Object id : ids) {
HashMap<String, Object> ins = instructors.get(id);
if (ins... |
828c0227-e715-44dd-90d9-aed71564aa47 | 1 | private void splitAndCreate(){
if (end == null){
String[] startDate = start.split(" ");
String[] sd = startDate[0].split("-");
String[] st = startDate[1].split(":");
String[] ed = getNowDate().split("-");
String[] et = getNowTime().split(":");
... |
a300f202-5c7b-4c33-a43a-7184446bb42d | 5 | @Override
protected void doPost(HttpServletRequest request,
HttpServletResponse response) {
String userID = request.getParameter("userID");
String pwd = request.getParameter("password");
UserAuthentication authentication = new UserAuthentication();
String type = authentication.authentic(userID, pwd);
if (... |
b3becfa7-c299-40ef-99f3-617d1753f6b1 | 8 | private static int decode4to3(
byte[] source, int srcOffset,
byte[] destination, int destOffset, int options ) {
// Lots of error checking and exception throwing
if( source == null ){
throw new NullPointerException( "Source array was null." );
} // end if
if( desti... |
c8e6ff74-de54-4065-a6b6-15e0c191ecca | 6 | public static void main(String[] args) {
clientUtils = new ClientUtils();
new Thread(new Runnable() {
@Override
public void run() {
try {
Socket socket = new Socket("127.0.0.1", 5000);
new PrintStream(socket.getOutputStream(... |
2b39b988-0884-48dd-9ce2-45d5a7fd487e | 1 | public boolean canImport(TransferSupport support) {
if (!support.isDrop()) {
return false;
}
return support.isDataFlavorSupported(DataFlavor.stringFlavor);
} |
2322a5be-222d-4281-a9e7-7aef512d7dbd | 1 | public boolean addSaveFormat(String formatName, SaveFileFormat format) {
if (isNameUnique(formatName, saverNames)) {
format.setName(formatName);
saverNames.add(formatName);
savers.add(format);
// Also add it to the list of formats stored in the preferences
Preferences.FILE_FORMATS_SAVE.add(formatNa... |
e16530ba-9bad-40a2-b4a2-27741771cc6a | 1 | @Override
public int compareTo(Milk m) {
long t=this.price*m.days-m.price*this.days;
if(t!=0) return (int)t;
return m.volume-this.volume;
} |
c3334360-627c-4098-b8b7-37f74cb662ea | 0 | public void addBar(int x, int y, int w, int h, int iD, Color barColorF)
{
barMap.put(iD, new Bar(x, y, w, h, iD, barColorF));
} |
84e0ce37-0baf-49cb-99da-1312f039a833 | 7 | public void vaccinateFracOfMostSocPeopleAtHighDegLocRestByHomeDist(int numVaccines, double fraction, int percentile, double minHomeDist, double maxHomeDist){
HashMap distances = EpiSimUtil.locationsRestByHomeDist(minHomeDist, maxHomeDist, percentile);
int numFetchRows = 100;
try {
Connection con = EpiSimUtil.d... |
742b8990-aa36-43df-b831-2fee738388f9 | 0 | public int getHeight() {
return height;
} |
8534c5cd-aa26-476e-a812-05bba1a7f2d4 | 3 | public void setOpacity(int v) {
if ((v < 0) || (v > 255)) {
throw new IllegalArgumentException("The opacity (" + v + ") must be between 0 and 255.");
}
this.adjustingOpacity++;
try {
this.opacitySlider.setValue(v);
this.alpha.spinner.setValue(new Integ... |
2deec537-c518-4d0c-856d-87ab4738b900 | 9 | private Integer diasDelMes(Integer mes, Integer anio)
{
if (mes==2)
{
if (anio % 4 == 0 && anio % 100 != 0)
return 29;
else if (anio % 400 == 0)
return 29;
else
return 28;
}
else
{
if(mes%2!=0)
{
if(mes>=1 && mes<7)
{
return 31;
}
else
{
return 30;
... |
3061e858-f185-43f7-9b89-e8fb4a522f20 | 6 | private String getDebugInfoFast(Game.CarInfo myCarInfo, Game game, double desiredSpeed, double throttle, AngleState as, double nextAngle, double r) {
GameInit.Race.Track.Piece piece = game.track.pieces[myCarInfo.pieceIndex];
if (r > 100000) {
r = 0;
}
double rst = (piece.radi... |
a0d1e84d-c87d-4410-a820-6ecdfd22a90b | 2 | private String getVkMethodRequest(String method, String parameters) {
Preconditions.checkNotNull(accessTokenDto, "You are not authorized.");
return MessageFormat.format(VK_METHOD_REQUEST_PATTERN, method,
!Strings.isNullOrEmpty(parameters) ? parameters : "",
!Strings.isNullOrEmpty(parameters) ? "&" : "",
... |
440cd5ba-3371-4fd2-9076-bc830cc92d52 | 5 | public BookStatus getBookStatus(long bookid)
{
BookStatus bookstatus = null;
Connection con = null;
Statement stmt = null;
try {
DBconnection dbCon = new DBconnection();
Class.forName(dbCon.getJDBC_DRIVER());
con = DriverManager.g... |
e1b17db5-c903-4bbd-9215-15db3c8f2837 | 4 | private void start(){
SAXParserFactory fabrique = SAXParserFactory.newInstance();
SAXParser parseur = null;
try {
parseur = fabrique.newSAXParser();
} catch (ParserConfigurationException e) {
e.printStackTrace();
} catch (SAXException e) {
e.pr... |
1367be4d-10c8-4e16-8c13-bdf190057dfb | 5 | final void method3669(Canvas canvas, int i, int i_578_) {
AbstractImageFetcher class348_sub31 = ((AbstractImageFetcher) fetcherTable.get((long) canvas.hashCode()));
if (class348_sub31 != null) {
class348_sub31.removeNode();
class348_sub31 = AbstractWorld.method1035(9029, i_578_, canvas, i);
fetcherTabl... |
65e14afc-a602-4f1f-bf16-c061fef64f2f | 7 | public void init() {
for (int i = 0; i < ID_SIZE; i++) {
for (int j = 0; j < ACTION_SIZE; j++) {
String filename = "res/id";
filename += i;
filename += '/';
filename += j;
filename += ".png";
this.insert(i, j, filename);
}
}
File datasheet = new File("res/Test_Data/TD_data.csv");
... |
751cb2a7-afdd-495f-8d20-e45ffcb5ac6a | 9 | protected boolean validateParameters(ParameterBlock args,
StringBuffer msg) {
if ( args == null || msg == null ) {
throw new IllegalArgumentException(JaiI18N.getString("Generic0"));
}
if (!super.validateParameters(args, msg)) {
r... |
a5ab7bb5-8ae5-4b01-880e-342705d95f4c | 8 | public void printPos() {
String message ="\n";
for(int i=0; i<HEIGHT; i++) {
message += "|";
for(int j=0; j<WIDTH; j++) {
if(pos[i][j] == EMPTY) {
message += " ";
} else if(pos[i][j] == RED) {
message += "R";
} else if(pos[i][j] == BLACK) {
message += "B";
}
message += "|";
... |
9ba00e32-d50f-448f-bb7a-f6b200a6b39c | 1 | synchronized public static org.omg.CORBA.TypeCode type ()
{
if (__typeCode == null)
{
__typeCode = org.omg.CORBA.ORB.init ().create_interface_tc (AccountHelper.id (), "Account");
}
return __typeCode;
} |
ba933b5f-bca7-43b7-8a6a-fcf93787a5a8 | 3 | private static Clip loadClip(String id, String path){
Clip clip = null;
try {
clip = AudioSystem.getClip();
AudioInputStream audioIn = AudioSystem.getAudioInputStream(new File(soundPath + path));
clip.open(audioIn);
audioIn.close();
System.out.println("[SoundManager] Loading clip: " + id);
return ... |
8eab45c3-e9b4-4982-aed3-c2757871498f | 2 | protected boolean isKey(String str) {
return str!=null && (str.startsWith("-") || str.startsWith("--"));
} |
f8600c7c-9791-406c-9108-1ea782d232d4 | 2 | public static <T> Collection<T> filter(Collection<T> collection, Predicate<T> predicate){
Collection<T> temp = new ArrayList<T>();
for(T t : collection){
if(predicate.evaluate(t)){
temp.add(t);
}
}
return temp;
} |
f6ff2a61-7b06-495f-8871-3b357ae290a6 | 4 | boolean anyOtherEndTag(Token t, HtmlTreeBuilder tb) {
String name = t.asEndTag().name();
DescendableLinkedList<Element> stack = tb.getStack();
Iterator<Element> it = stack.descendingIterator();
while (it.hasNext()) {
Element node = it.next();
... |
2d25189a-20d4-4f82-b5b6-d8bc79b94fa0 | 2 | public void updateStatistics(ScoreType type, Session from) {
if (this.userId == 0) {
return;
}
try {
java.sql.PreparedStatement statement = HyperPVP.getStorage().queryParams("INSERT INTO `users_statistics` (`from_id`, `to_id`, `type`, `time`, `map`, `mode`) VALUES (?, ?, ?, ?, ?, ?)"); {
statement.s... |
4d8d3664-9c2a-4d9e-9456-976b63e19337 | 3 | public final String toPluginData() {
int voiceIdx = 0;
final StringBuilder sb = new StringBuilder();
sb.append("\t\t\t{\r\n");
if (this.sortedVoices.isEmpty()) {
// no X:-line
sb.append("\t\t\t\t[");
sb.append(String.valueOf(++voiceIdx));
sb.append("] =\r\n\t\t\t\t{\r\n");
sb.append("\t\t\t\t\t[\... |
134b5668-74f6-4a31-bd88-d06d064e5bac | 0 | protected boolean isFinished() {
return false;
} |
0ae1b883-1c4c-44f5-95c8-082aedf7a2f7 | 8 | public static void main(String... args) throws IOException {
MyScanner sc = new MyScanner();
int t = sc.nextInt();
_nextTest:
for (int tt = 0; tt < t; tt++) {
int n = sc.nextInt();
int p = sc.nextInt();
boolean[][] g = new boolean[n][n];
... |
e08771a2-85fa-427c-b007-c543276eeb31 | 9 | private static Skill pickResearchTopic(Actor actor, Archives archives) {
final World world = actor.world() ;
final Background v = actor.vocation() ;
//
// Pick skills relevant to the actor's current job (or one they aspire to).
// TODO: Have the actor's core AI make this selection at infrequ... |
faa6fdb6-d897-4d4c-a395-4c70cae625e3 | 7 | public void moveFrog(int direction){
if(direction == 1){
frogRectangle.y -= FROG_SPEED;
leftHalf.y -= FROG_SPEED;
rightHalf.y -= FROG_SPEED;
backHalf.y -= FROG_SPEED;
frontHalf.y -= FROG_SPEED;
}else if(direction == 2 && frogRectangle.y + frogRectangle.height < FrogsterConstants.JPANEL_SIZE){
frog... |
90df3e52-534c-4881-925a-267fc284e01c | 8 | public static boolean saveObject(Object object, String name, boolean temp) {
FileOutputStream outputFile;
JAXBContext context;
Marshaller marshaller;
File file;
String s = null;
if (Tournament.class.isInstance(object)) {
if (!temp) {
file = new... |
d419f8de-51e8-46f9-9659-04d0794f93ba | 0 | public void setFecha(int fecha) {
this.fecha = fecha;
} |
c1d534e6-0aed-4db5-9870-2a4b9a780f82 | 2 | public void localDelete(String local_path) {
DBLikeFileObject search = null;
Iterator<DBLikeFileObject> itr = localDB.iterator();
while (itr.hasNext()) {
search = itr.next();
if (search.getLocalFilePath().equals(local_path)) {
localDB.remove(search);
break;
}
}
} |
7a342743-5616-4313-80fb-aa3f08321391 | 0 | public static Graphics2D getGraphics() {
return g;
} |
02f7b5c1-6e1b-4b99-b969-828a0b24de9d | 6 | public String statement (){
double totalAmount = 0;
int frequentRenterPoints = 0;
@SuppressWarnings("rawtypes")
Enumeration rentals = _rentals.elements();
String result = "Rental Record for "+getName() + "\n";
while (rentals.hasMoreElements()){
double thisAmount = 0;
Rental each = (Rental) rentals.nex... |
64bb0cd1-1e65-4f53-bfa8-acbb12590610 | 6 | public void show(iadmitere a) throws AdmitereExceptions{
int i = 0;
while(i != 4){
MeniuPrincipal();
i = Read();
switch(i){
case 1:
a.GenerareStudenti("rezultate.txt");
System.out.println("Fisierul rezultate.txt a fost creat cu succes");
break;
case 2:
a.CandidatiReusiti();
for(Ma... |
a86f1262-9da1-413e-a3ca-b5933d15f2f7 | 9 | public static void main(String args[]) throws Throwable {
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
for (String ln;(ln=in.readLine())!=null;) {
StringTokenizer st=new StringTokenizer(ln);
TreeSet<Integer> A=new TreeSet<Integer>(),B=new TreeSet<Integer>(),cA=new TreeSet<Integer>... |
5a39aa0d-ee0c-4d32-9b72-56294f90fe3e | 6 | public void paint1(Graphics g) {
if (perCrowbar != null & lnkCharolas != null & lnkProyectiles != null) {
//Dibuja la imagen de Nena en la posicion actualizada
g.drawImage(perCrowbar.getImagen(), perCrowbar.getX(),
perCrowbar.getY(), this);
//Dibuja a la... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.