method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
f8fb1fb9-a040-4e3e-a392-8cf15507d81e | 0 | @Column(name = "item_id")
@Id
public int getItemId() {
return itemId;
} |
2625a70a-3089-49f5-bc49-969417e4707d | 0 | public void mouseEntered(MouseEvent e) {
} |
feb44923-93f8-4fba-8b77-5faab4d9dd15 | 6 | * @param string2
* @param otherstrings
* @return String
*/
public static String string_concatenate(String string1, String string2, Cons otherstrings) {
if (otherstrings.length() == 0) {
return (Native.stringConcatenate(string1, string2));
}
{ StringBuffer result = null;
int length = s... |
04d76479-3921-455c-b0fd-931bd64620ec | 3 | private boolean positionJouable(Couleur uneCouleur, Position unePosition)
{
Case laCase = this.plateau.obtenirCase(unePosition);
if (laCase.estOccupee())
return false;
for (Direction direction : Direction.values())
{
if (encercleAdversaire(uneCouleur, laCase.obtenirPosition(),
direction))
retur... |
579bfae1-37fe-4e97-995e-7dc66c5f516f | 7 | public static void Mute(CommandSender sender, String muted, Long time){
if (sender instanceof Player) {
if (!Access.canMute((Player) sender)){
sender.sendMessage(Msg.$("not-permitted"));
return;
}
if (time == -1) {
if (!Access.c... |
97afd5df-80eb-4956-876d-830d57b1db17 | 3 | private void checkWorkerLiveness(){
//System.out.println("monitor timer expire!");
Set<Integer> workerIdSet = workerStatusMap.keySet();
Iterator<Integer> idIterator = workerIdSet.iterator();
while(idIterator.hasNext()){
int id = idIterator.next();
if(work... |
3e08edad-f6e3-4891-b1ec-e6555be4b4ce | 3 | public int read(byte[] buffer, int offset, int length) {
if (closed) {
return -1;
}
int totalBytesRead = 0;
while (totalBytesRead < length) {
int numBytesRead = super.read(buffer,
offset + totalBytesRead,
length - totalBytesRead);
... |
527ccaaf-6638-44f2-85e9-5fe4b869bdb1 | 1 | public static void main(String[] args) {
EventQueue.invokeLater(new Runnable() {
public void run() {
try {
CreateManager frame = new CreateManager();
frame.setVisible(true);
} catch (Exception e) {
e.printStackTrace();
}
}
});
} |
2c84c74d-94f6-411e-b1f8-3b2efbaa0cff | 3 | @Test
public void resolve() {
long[][] data = loadArrays("data"+File.separator+"p018.txt");
int E=data.length-1;
for(int i=E-1;i>=0;i--){
for(int j=0;j<=i;j++){
data[i][j]+=data[i+1][j]>data[i+1][j+1]?data[i+1][j]:data[i+1][j+1];
}
}
print(data[0][0]);
} |
aa90c8fc-c3b1-4bb2-80bb-da8b8c05a378 | 1 | public static ThrowCalculator makeCalculator(String difficulty) {
if (difficulty.equalsIgnoreCase("random")) {
return new RandomThrow();
} else {
return new SmartThrow();
}
} |
babb7d5f-ef90-44e5-8c5e-f71cc0902ac5 | 9 | public static void cppHelpOutputBinaryOperator(Cons expression, int nestlevel) {
{ Stella_Object arg1 = expression.value;
StringWrapper op = ((StringWrapper)(expression.rest.value));
Stella_Object arg2 = expression.rest.rest.value;
if (StringWrapper.cppNestedOperatorNeedsParenthesesP(op, arg1)) {... |
70d48f12-5cbe-4bc0-a167-c287e40ac636 | 1 | public void setQuery(String query) {
this.query = query;
if (this.query != null) {
this.query_list = new ArrayList();
parseQuery(this.query_list, this.query);
}
} |
23d651d0-5228-4aec-a291-16ada3eaf962 | 0 | @Test
public void testIsBrowser() {
assertTrue(Application.GMAIL.isInReferrerString("http://mail.google.com/mail/?ui=1&ik=xx&view=cv&search=inbox&th=xx&ww=xx&cvap=5&qt=&zx=xx"));
} |
2c7c4a17-67ee-44f8-bd3c-6eed0844d7d8 | 6 | @SuppressWarnings("static-access")
public ProcessCommandImpl(Socket requestSocket1,
PropertiesConfiguration prop2) {
try {
this.requestSocket = requestSocket1;
this.prop =prop2;
wait = prop.getInt("ThreadSleep_period");
timePeriod=prop.getInt("TimePeriod");
printWriter = new PrintWriter(request... |
1bc6816b-974e-422c-8819-d06365263cec | 9 | public PerformanceRecord getPerformanceRecord(String fileName) throws IOException {
BufferedReader reader = new BufferedReader (new FileReader(fileName));
String line;
String result = "";
String propertyVerified = "";
double userTime = 0;
double systemTime = 0;
long bddNodes = 0;
String formatted = "... |
90b18da9-c795-4caf-a2ab-f2caefc05a4f | 3 | private void setScores(){
String eol = System.getProperty("line.separator");
String name;
String score;
try{
Writer output = new BufferedWriter(new FileWriter(scorecard));
if(scores.size() == 0){
output.write("JCAL" + eol);
output.w... |
1e43ba4d-6218-44a8-b483-82a189f03f59 | 7 | public int getRightDiag(int i, int j, int r) {
int sum = 0;
int imax = this.length;
int jmax = this.width;
for (int n = 0; n <= 2 * r; n++) {
int ii = topo.idI(i + r - n, j - r + n, imax, jmax);
int jj = topo.idJ(i, j - r + n, imax, jmax);
if ( (!(ii < 0) && !(ii >= imax)) && (!(jj < 0) && !(jj >= jmax... |
57041170-3fc8-4559-b4b9-78ced0d0fb71 | 4 | public int destroy() {
if (lifecycleSupport == null) {
return handleErrno(Errno.ENOTSUPP);
}
if (log != null && log.isDebugEnabled()) {
log.debug("destroy: shutdown filesystem");
}
try {
return handleErrno(lifecycleSupport.destroy());
... |
f2fc0ca0-91b6-4792-a878-1373ec6275da | 8 | static void build_key_square(char[][] square,String key)
{
boolean[] filled=new boolean[26];
String key_u=key.toUpperCase();
int cur_row=0;
int cur_col=0;
for(int i=0;i<key_u.length();i++)
{
char cur_c=key_u.charAt(i);
if(cur_c=='J')
{
cur_c='I';
}
int order=cur_c-'A';
i... |
58637ed3-c6fc-4a8b-9697-a86aef4faf65 | 2 | public float getPreferredSpan(int axis) {
int extra = 2*(getBorder()+getSpace(axis));
switch (axis) {
case View.X_AXIS:
return fWidth+extra;
case View.Y_AXIS:
return fHeight+extra;
default:
throw new IllegalArgumentException("Invalid axis: " + axis);
}
} |
b8598296-ef7d-4009-b6f2-8832cf167e58 | 9 | public static int numberOfDays (int num)//enter month number
{
if (num==1||num==3||num==5||num==7||num==8||num==10||num==12)
return 31;
else if (num==2)
return 28;
else if (num==-2)//leap year
return 29;
else
return 30;
} |
57844384-b544-483f-88d1-562d49aa0764 | 5 | public void update(World w)
{
repaint();
currGeneration = w.getGeneration();
int nxtPopulation = w.getPopulation();
double growthRate = 0.0, deathRate = 0.0;
if (currGeneration == 0)
{
maxPopulation = nxtPopulation;
minPopulation = nxtPopulation;
}
else
{
growthRa... |
d919e257-937d-40aa-9b5c-d1febbdb2745 | 6 | static public Object deserializeArray(InputStream in, Class elemType, int length)
throws IOException
{
if (elemType==null)
throw new NullPointerException("elemType");
if (length<-1)
throw new IllegalArgumentException("length");
Object obj = deserialize(in);
Class cls = obj.getClass();
... |
02768995-57c4-4f16-83b2-c420dbb0bdde | 6 | public void update() {
getNextPosition();
checkTileMapCollision();
setPosition(xtemp, ytemp);
//check flinching
if(flinching) {
long elapsed = (System.nanoTime() - flinchTimer) / 1000000;
if(elapsed > 400) {
flinching = false;
}
}
// if hits a wall, go other direction
if(facingRigh... |
2d33a723-be42-4283-85b4-6dcd925bcf31 | 1 | public static String escapeString(String str) {
try
{
escapeHelper.setString(1, str);
} catch (SQLException e)
{
// TODO Auto-generated catch block
e.printStackTrace();
}
String rtn = escapeHelper.toString();
return rtn.substring( rtn.indexOf( ": " ) + 2 );
} |
b34e2312-9641-4503-9d34-f49555b7eef7 | 5 | @Override
protected void processRequest(HttpServletRequest request, HttpServletResponse response) throws IOException {
try {
String title=request.getParameter(Room.TITLE);
int masterRoom=Integer.parseInt(request.getParameter(Room.MULTIPURPOSE_ROOM));
int capacity=Integer.parseInt(request.getParameter(Room.C... |
a6b85cd9-1de3-43ad-9f9b-cf889bbb3c51 | 9 | public static void multiplicatoria(TreeMap<Integer, Integer> raiz) {
TreeMap<Integer, Integer> casa = (TreeMap<Integer,Integer>)raiz.clone();
for (Entry<Integer, Integer> entry : casa.entrySet()) {
if (entry.getKey() < 500 && !arr[entry.getKey()])
continue;
int i = 0;
for (i = 0; i < primos.length; i+... |
883f339d-77ea-4a0e-9ea7-5b3ec716d411 | 5 | public void close(Connection con,PreparedStatement preparedStatement,ResultSet rs){
try {
if(rs!=null){
rs.close();
rs = null;
}if(preparedStatement!=null){
preparedStatement.close();
preparedStatement = null;
}if(con!=null&&!con.isClosed()){
con.close();
con = null;
}
} catch (S... |
9360a353-ec40-46c5-bcc8-af48afb4cc75 | 3 | static public void decodeFile(String src)
{
byte[] fileBytes;
try {
fileBytes = read(new File(src));
for(int n=0;n<fileBytes.length;n++)
{
fileBytes[n]-=key;
}
write(src, fileBytes);
} catch (FileNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IO... |
5301a942-51a7-4e64-8170-0975cbdad1b9 | 4 | @Override
public void execute(VGDLSprite sprite1, VGDLSprite sprite2, Game game)
{
int[] gameSpriteOrder = game.getSpriteOrder();
int spriteOrderCount = gameSpriteOrder.length;
for(int i = 0; i < spriteOrderCount; ++i)
{
int spriteTypeInt = gameSpriteOrder[i];
... |
3a5de291-b1d0-476d-92e6-ede03ca18ec1 | 2 | public void stopCurrentBattle() {
if(current != null) {
// shut it down to stop it quickly
current.stop();
current.setFPS(BattleRunner.START_FPS);
// unpause it (or it will never stop)
if(current.isPaused()) {
current.setPaused(false);
}
current = null;
}
} |
2da69c89-ef46-49b7-b1c7-01a327c75315 | 4 | protected void doTestCycAccess14(CycAccess cycAccess) {
long startMilliseconds = System.currentTimeMillis();
if (cycAccess.getCycConnection() != null) {
System.out.println(cycAccess.getCycConnection().connectionInfo());
} else {
System.out.println("CycConnection info is null.");
}
rese... |
09994885-2408-47ec-86a6-d031a867d1c1 | 7 | @Override
public boolean invoke(MOB mob, List<String> commands, Physical givenTarget, boolean auto, int asLevel)
{
if((mob.location().domainType()!=Room.DOMAIN_INDOORS_CAVE)
&&((mob.location().getAtmosphere()&RawMaterial.MATERIAL_ROCK)==0))
{
mob.tell(L("This magic only works in caves."));
return false;
... |
147480a9-29bd-486f-aa05-e18aef530bde | 2 | @SuppressWarnings ( {
"unused", "resource"
} )
@Test
public void testWriteJournal () throws Exception {
if ( this.socketAddress == null ) {
return;
}
try ( AFUNIXSocket sock = connectToServer() ) {
System.err.println("Client running");
In... |
1c60bf63-4cf8-4923-a67d-4102a4e90533 | 5 | public void randomState()
{
Random rand = new Random();
int index = rand.nextInt(5);
this.clearLore();
int copy = index;
HashMap<String,Integer> map = new HashMap<String, Integer>();
for(Map.Entry<String,Sender> entry : Main.map.entrySet()){
if(entry.... |
4c1128c7-4ca5-4829-9a21-eb0623b948d1 | 0 | @Override
public String toString() {
return "MESSAGE(MULTICASTMESSAGE)\n{"+ source +"->"+ dest +" seqNum:"+ seqNum +" duplicate:"+ duplicate +" kind:"+ kind
+" data:"+ data +" \nTIMESTAMP[:" + this.timeStamp + " ]\nACK:" + this.acknowledgement + "} "
+ "\nGROUPCLOCK = {" + clockForGroup.toString() + "}";... |
553cbd60-df98-4bb8-a342-979047980354 | 4 | public DatosIteracion masVisibles() {
DatosIteracion d = new DatosIteracion("auxiliar");
Lectura l = new Lectura(999999, 0, 0);
d.getValoresLecturas().add(l);
for (int i = 0; i < this.getValoresIteraciones().size(); i++) {
if (d.getValoresLecturas(d.getValoresLecturas().size() - 1)
.getnNodos() < thi... |
b82fd7e8-78a2-4bb2-b9de-dbe7cddd58b3 | 5 | public boolean deleteProdutos(Produtos produtos){
this.getConectaBanco();
try {
if (this.getConn()!= null || !this.getConn().isClosed()) {
this.getConn().setAutoCommit(false);
this.setStmt(this.getDeleteProdutos());
this.getStmt().setInt(1, produtos.getIdProduto());
this.get... |
9121ea3c-637d-454c-b763-2fecf9694236 | 7 | @SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
CadQuestButton = new javax.swing.JButton();
ConsQuestButton = new javax.swing.JButton();
ImportAlunoButton = new javax.swing.JButton()... |
28f77da0-4c4d-4b24-8d39-f1acc07073ac | 5 | @EventHandler
public void onPlayerJoin(PlayerJoinEvent event) {
Player player = event.getPlayer();
if (!playerConfig.contains("players." + player.getUniqueId().toString())) {
playerConfig.set("players." + player.getUniqueId().toString() + ".name", player.getName());
playerConfigClass.saveConfig();
... |
cb03fb82-c6f3-4660-b1f6-60f1adcacb81 | 0 | public void setLineeOrdine(List<OrderLine> lineeOrdine) {
this.lineeOrdine = lineeOrdine;
} |
b3490b5b-2162-48a1-b2b4-f0e90f69d558 | 6 | Node add(Node t, Object key, Object val, Box found){
if(t == null)
{
if(val == null)
return new Red(key);
return new RedVal(key, val);
}
int c = doCompare(key, t.key);
if(c == 0)
{
found.val = t;
return null;
}
Node ins = c < 0 ? add(t.left(), key, val, found) : add(t.right(), key, val, found);
... |
18039140-0784-44d5-9998-ed7bf2b4ae73 | 0 | public String getFixedFee() {
return FixedFee;
} |
26f3272e-e129-4fb5-85ac-c7bbc6d19d9c | 3 | double rate(Board board) {
int holes = 0;
// Count the holes, and sum up the heights
for (int x=0; x<board.getWidth(); x++) {
final int colHeight = board.getColumnHeight(x);
int y = colHeight - 2; // addr of first possible hole
while (y>=0) {
if (!board.getGrid(x,y)) {
holes++;
}
... |
940d9bf2-a2ef-43ec-96e2-95bd6d1a8341 | 4 | private boolean checkModels(List<Particle> seqParticles, List<Particle> paraParticles) {
for(Particle p1: seqParticles){
for(Particle p2: paraParticles){
if(compareParticles(p1,p2)){
paraParticles.remove(p2);
break;
}
}
}
if(paraParticles.size() == 0)
return true;
return false;
} |
2e0afe82-2771-4fbd-a71f-34d4376c7dcf | 4 | private void dealtDamage()
{
if (player.equals("P1"))
{
if (direction)
{
getWorld().addObject(new P1AttackArea(x,y,1000,50,1,0,2.0,2,direction),x, y);
}
else
{
getWorld().addObject(new P1AttackArea(x,y,10... |
7330cc59-30bb-43f8-b2da-96c709310a97 | 7 | public static void main(String[] args) throws IOException {
Scanner in = null;
FileReader fin = null;
/* If there is one argument, it is the file to be read from. */
if (args.length == 0) {
in = new Scanner(System.in);
} else if (args.length == 1) {
fin =... |
3d79f9ec-e7dd-4d41-b82c-53d6fc1dbe16 | 4 | public int getColumnHeight(int x) {
if(caching && !columnHeightDirties[x]) {
return _columnHeights[x];
}
columnHeightDirties[x] = false;
for (int j = height - 1; j >= 0; j--) {
if (grid[x][j]) {
return (_columnHeights[x] = j+1);
}
}
return (_columnHeights[x] = 0);
} |
3069f7d1-7252-42d1-be13-47308a54ca7f | 8 | public void update(double time_difference) {
// Update delay
if (is_delaying) {
if (delay_timer <= 0) {
is_delaying = false;
} else {
delay_timer = Math.max(0, delay_timer - time_difference);
return;
}
}
// Update timer
timer += time_difference;
if (timer >= typing_wait) {
timer -= t... |
c49efc51-3a09-439b-8ed2-6560a3536b1a | 3 | Atom merge( Atom other ) throws Exception
{
if ( other instanceof Fragment )
{
// if the other is a fragment then add it as a new row
Fragment f = (Fragment)other;
if ( !contains(f) )
{
Row r = new Row( sigla, groups, base );
... |
4b8f4a4c-2665-4441-9de2-b5cb0645999b | 7 | @Override
protected Void doInBackground()
{
String search = "https://ajax.googleapis.com/ajax/services/search/web?v=1.0&q=";
search += button.getText().replace(" ", "+") + "+imdb";
try
{
URL url = new URL(search);
URLConnection connection = url.openConnection();
String line;
... |
1cefb7bd-4e17-464f-96fc-5d6592c2045e | 6 | @Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
Funcionario other = (Funcionario) obj;
if (id == null) {
if (other.id != null)
return false;
} else if (!id.equals(other.id))
return ... |
e9b3f8c2-629c-44b4-8a44-5859ae946349 | 5 | public static void changeGrade() throws IOException
{
fillArray.createArraylist();
makeGPA.createGPA();
for(int x=0;x<Students.database.size(); x++)
{
System.out.println("\n" + (x+1)+".)"+" "+Students.database.get(x));
}
System.out.println("What is the number of the student you would like to change."... |
a7be2e78-41a9-469e-af27-1719b0cd73c3 | 6 | private double getSimpleMass(Body body1, Body body2) {
double mass = 0;
Body ancestor = body1.parent;
while (ancestor != null) {
if (ancestor == body2) {
return body2.mass;
}
ancestor = ancestor.parent;
}
if (body1.parent == body2.parent
// Sibling case: bundle niblings with siblings
|| bod... |
30799c6c-cd97-442e-aa47-2b200271029f | 3 | public boolean tarkistaLoppusumma(){
int summa = 0;
for (Tulosruutu ruutu : pelaaja.annaTulosrivi().annaTulosruudut()){
if(ruutu.annaTyyppi().tyyppi!=17&&ruutu.annaTyyppi().tyyppi!=18){
summa = summa + ruutu.annaPisteet();
}
}
pelaaja.... |
1d0db732-e1a2-4ef6-a661-fd278adf0882 | 3 | private void drawStores(Graphics g){
int screenRes = Toolkit.getDefaultToolkit().getScreenResolution();//Using Toolkit class and the calculate the correct font size
int fontSize = (int)Math.round(7 * screenRes / 72.0); //calculate the correct font size
Font f = new Font("Arial", Font.BOLD, fontSize);
... |
a2d308e3-6308-4237-a805-9679b2c20539 | 0 | public int diferenca(Data d1) {
int totalDias = contaDias();
int totalDias1 = d1.contaDias();
return Math.abs(totalDias-totalDias1);
} |
09bd1919-8124-49a0-88d4-e00988ce9489 | 2 | public Double checkEmotionalSentiment ( String str ) {
// System.out.println("hhh : " + str);
if ( isPositiveSentiment(str) ) return 1.0;
else if ( isNegativeSentiment(str) ) return -1.0;
return 0.0;
} |
903dd7d4-fe01-4420-8817-8d6df5140bf6 | 4 | public boolean isUpperHessenberg(){
boolean test = true;
for(int i=0; i<this.numberOfRows; i++){
for(int j=0; j<this.numberOfColumns; j++){
if(j<(i+1) && this.matrix[i][j]!=0.0D)test = false;
}
}
return test;
} |
8f1020ad-854f-4984-913b-752d9c5ed569 | 9 | protected void update(Color winner, Board finalBoard, boolean[][][] moves) {
sims++;
if (winner != turn)
wins++;
// Update AMAF (RAVE) values
if (isLeaf && !isRoot) {
int parentTurn = parent.turn.ordinal();
for (Node sibling: parent.children) {
int x = sibling.recentPoint.x, y = sibling.recentPoin... |
e785bbd2-e86e-4907-9682-dda2df1c1699 | 3 | public void saveNewItem(PosListaPrecio itemOracle,
int idPos){
if (itemOracle.getPcaPrecioVenta() == null) {
logger.info(" ======== ITEM NO CREADO Precio de Venta NULO ======== ");
logger.info("itemOracle.getPcaIdElemento() = " + itemOracle.getPcaIdElemento());
logger.info("item... |
970bdfa9-5312-4baf-8c08-c8c99485cfad | 3 | private boolean isColorTaken(JoinGameRequest request,
List<PlayerDescription> players, int playerGameIndex) {
boolean colorTaken = false;
for (int i = 0; i < players.size(); i++) {
PlayerDescription pd = players.get(i);
if (pd.getColor().toLowerCase().equals(request.getColor().toLowerCase()) && i != player... |
d5c49f75-5f35-41e3-bd9a-8c3984ee3ad0 | 6 | private static boolean isFloat(String lexeme) {
// Double.parseDouble and Float.parseFloat does not work for this
char firstChar = lexeme.charAt(0);
if (firstChar == '.') {
return false;
}
if (!lexeme.contains(".")) {
return false;
}
int count = 0;
char[] lexemeArray = lexeme.toCharArray();
f... |
b65083ee-454f-4656-a1c7-acf511c1f862 | 9 | public void resetTabIcons() {
ArrayList icons = new ArrayList();
DockKey k = getDockable().getDockKey();
if(k.isCloseEnabled() && isCloseButtonDisplayed) {
icons.add(closeSmartIcon);
}
if(k.isMaximizeEnabled() && isMaximizeButtonDisplayed) {
icons.add(maximizeSmartIcon);
}
if(k.isAutoHideEnabled() &... |
f4258d99-2bdf-41a7-8b96-692bf2a6631a | 9 | private void affine_nearest_xy(final Image image, final Image affined) {
// Initialization:
messenger.log("Nearest-neighbor sampling in x-y");
progressor.status("Affine transforming"+component+"...");
progressor.steps(odims.c*odims.t*odims.z*odims.y);
// Affine transform using the backward transformatio... |
f8a9c9b1-3d04-47a0-a831-2146ed5a8c27 | 6 | public void run() {
if (this.recipients == null) {
for (String messageLine : this.message.split("\n")) Bukkit.broadcastMessage(messageLine);
}
else if (this.recipients.isEmpty()) {
for (String messageLine : this.message.split("\n")) this.sender.sendMessage(messageLine);
}
else {
Str... |
8682ce8e-d0d6-41c1-92dc-d9ccfdf5f35f | 5 | static String isField(ClassPool pool, ConstPool cp, CtClass fclass,
String fname, boolean is_private, int index) {
if (!cp.getFieldrefName(index).equals(fname))
return null;
try {
CtClass c = pool.get(cp.getFieldrefClassName(index));
if (c =... |
c5401589-1d7c-49a4-a060-26b8872d6b8b | 5 | public static String getServerIP(){
if(serverip == null) {
final int port = Bukkit.getPort();
if(Bukkit.getServer().getIp() == null){
serverip = Bukkit.getServer().getIp();
if (port != 25565)
serverip += ":"+port;
}
URL whatismyip;
try {
whatismyip = new URL("http://BattlePunishme... |
70ddefa3-590d-4274-bac5-4d81785002f2 | 2 | public Drivability isDriveable(Vehicle c) {
if (c.getOrientation()== _lightControl.getState().getAllowedOrientation()) {
if (_lightControl.getState().isYellow()) {
return Drivability.Caution;
}
return Drivability.Driveable;
} else {
return Drivability.NotDriveable;
}
} |
ff55c9e8-d382-4233-b961-9b03efaa6d4e | 1 | public void testSetSecondOfMinute_int2() {
MutableDateTime test = new MutableDateTime(2002, 6, 9, 5, 6, 7, 8);
try {
test.setSecondOfMinute(60);
fail();
} catch (IllegalArgumentException ex) {}
assertEquals("2002-06-09T05:06:07.008+01:00", test.toString());
} |
262589a3-46bf-462f-bfcc-b645bb8992e9 | 3 | @Override
public void maskedCopyFrom(MapLayer other, Area mask) {
Rectangle boundBox = mask.getBounds();
for (int y = boundBox.y; y < boundBox.y + boundBox.height; y++) {
for (int x = boundBox.x; x < boundBox.x + boundBox.width; x++) {
if (mask.contains(x,y)) {
... |
61f00cbd-8114-452b-8281-d7b3e1dbc56c | 9 | public boolean shouldDefer(StringAppender inBuf) {
char[] buffer = new char[inBuf.length()];
inBuf.getChars(0, inBuf.length(), buffer, 0);
depth = cdepth = 0;
for (int i = 0; i < buffer.length; i++) {
switch (buffer[i]) {
case '/':
if (i + 1 < buffer.length && buffer[i + 1] == '... |
9312a67c-ac0b-4caf-9d6a-fcb67e73dda4 | 4 | public static void download(URL url, File file) throws IOException {
if (!file.getParentFile().exists())
file.getParentFile().mkdir();
if (file.exists())
file.delete();
file.createNewFile();
int size = url.openConnection().getContentLength();
Util.info("Downloading " + file.getName() + " (" + size / 102... |
f0ec006b-704e-40f7-a75c-1b460ce54585 | 3 | private void sendColorMessage(Color c, Node to) {
S4Message msg = new S4Message();
msg.color = c;
if(Tools.isSimulationInAsynchroneMode()) {
// sending the messages directly is OK in async mode
if(to != null) {
send(msg, to);
} else {
broadcast(msg);
}
} else {
// In Synchronous mode, a n... |
9d468989-d2d0-480f-b962-aab73807c35b | 7 | @EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void onBlockPlace(BlockPlaceEvent event)
{
// CAUTION:This event fires, BEFORE the placed block is removed from the inventory!
// therefore, delay all checks for 1 tick because "itemInHand()" is needed for checks
// ... |
e93ebcad-58f2-416b-bfbd-8314477cbf5d | 8 | void test() {
// Объявляем переменные
int x=127, y;
// y - не инициализированная переменная,
// использовать её компилятор не даст
//x=y; // => Ошибка компиляции
double фыва=77.7; // можно, но не нужно!
String myFirstString="Hello!"; /... |
1026781e-7969-4498-9b70-9fa8f6b08cb2 | 7 | public ArrayList<String> getSensorRecord(String sensor_id) throws NotFoundException, IllegalAccessError, SocketTimeoutException {
ArrayList<String> recordList = new ArrayList<String>();
try {
clientSocket.Escribir("HISTORICO " + sensor_id + '\n');
serverAnswer = clientSocket.Leer();
recordList.add(new Stri... |
88bc26bb-4451-4f0b-8608-a8a714028d68 | 7 | public static void main (String args[]){
Scanner entrada = new Scanner(System.in);
System.out.println("Digite um número: \n"+
"1 – calcular o fatorial de um número dado\n" +
"2 – calcular a raiz quadrada de 3 números dados\n" +
"3 – imprimir a tabuada comp... |
e813da43-c440-4a4b-8242-a0c439e5f7a7 | 9 | public static Method getAsMethodOfPublicBase(Class<?> c, Method m){
for(Class<?> iface : c.getInterfaces()){
for(Method im : iface.getMethods()){
if(isMatch(im, m)){
return im;
}
}
}
Class<?> sc = c.getSuperclass();
if(sc == null){
return null;
}
for(M... |
a42278c7-b3ba-4f4b-8882-edf5382f2001 | 7 | @Override
public void ParseIn(Connection Main, Server Environment)
{
DatabaseClient DB;
try {
DB = new DatabaseClient(Environment.DataBase);
}
catch (Exception ex)
{
Environment.Log.Print(ex);
Main.Disconnect();
return;
... |
57c8cbc6-71f7-45eb-ab6e-a24bf1e334fb | 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... |
5b88ed8f-979a-4a1f-8005-2edfdff2d6ec | 7 | private GuanYu fetchValueFromRequest(HttpServletRequest request,GuanYu guanYu) {
String id = StringUtil.toString(request.getParameter("id"));
String gsjianjie = StringUtil.toString(request.getParameter("gsjianjie"));//公司简介 中文
String tzcelue = StringUtil.toString(request.getParameter("tzcelue"))... |
d4cd6e0d-5e01-46d3-ba41-72aee9e41c1e | 7 | @Override
public void mouseReleased(MouseEvent e) {
if (!potentialDrag) {
return;
}
source.removeMouseMotionListener(this);
potentialDrag = false;
if (changeCursor) {
source.setCursor(originalCursor);
}
if (destination instanceof JCo... |
7487057d-216c-483b-959e-44aff73e8af8 | 6 | private byte compareDate(byte[] date1, short offset1, byte[] date2,
short offset2) {
short year1 = (short) ((short) (date1[offset1] * 10) + date1[(short) (offset1 + 1)]);
short year2 = (short) ((short) (date2[offset2] * 10) + date2[(short) (offset2 + 1)]);
short month1 = (short) ((sh... |
6a9766d6-35ff-4349-993c-ee7c9fd4a942 | 5 | public void inputHandler() {
if(Keys.isPressed(Keys.ENTER)) select();
if(Keys.isPressed(Keys.UP)) {
if(currentChoise > 0) {
//AudioBox.play("menuChanged", 0);
currentChoise--;
}
}
if(Keys.isPressed(Keys.DOWN)) {
if(currentChoise < options.length - 1) {
//AudioBox.play("menuChanged", 0);
... |
8eb4d3a5-35cc-4c4d-ad3e-0e28356ce9cd | 3 | @Deprecated
public boolean createTable(String query) {
Statement statement = null;
if (query == null || query.equals("")) {
this.writeError("Could not create table: query is empty or null.", true);
return false;
}
try {
statement = connection.createStatement();
statement.execute(query);
... |
99267d94-4b88-4eec-af34-2d83a977bf98 | 8 | public ContentObject changeTypeOfRegion(ContentObject region, RegionType newType) throws IllegalArgumentException {
if (region == null || !(region.getType() instanceof RegionType))
throw new IllegalArgumentException("Not a region: "+region.getType());
if (region.getType().equals(newType))
return region;
... |
b2539018-54d9-42f3-bd04-88970fe49506 | 0 | public Priority getPriority() {
return priority;
} |
bb18a578-7d53-4a8a-a059-c0c8620f6ae1 | 4 | public void draw(Graphics2D g) {
Tool tool = controls.getTool();
// vykresli polhranu
if (begin != null && graph.player.state == RunState.stopped
&& tool.compatible(ToolType.create) && tool.compatible(ToolTarget.edge)) {
g.setColor(new Color(0, 0, 0));
g.d... |
bb85a409-5fd3-41a2-93d3-f2bfd279f967 | 1 | public void setState(int state) {
this.state = state;
if(container != null) {
container.fireEvent(new StateChangeEvent(this, this.state));
}
} |
b03b3930-ccb2-4848-8897-5893a65b5214 | 1 | protected void setFocusToButton(int i) {
if (i > this.buttons.length) {
throw new IllegalArgumentException();
}
this.buttons[i].grabFocus();
} |
b302b113-6310-4686-80bc-c8567e66534e | 0 | public Knowledge() {
//ArrayList<Event> tempEvents = new ArrayList<>();
events = new ArrayList<>();
/*
************************************************************************
*/
String[] czajowniaDescription;
czajowniaDescription = new String[4];
czajo... |
767a176b-01e2-496b-8a5c-b8333b0acc99 | 2 | public void testContains() {
final String cols = "stringCol,doubleCol,dateCol,bigDecimalCol,intCol\r\n"//
+ "hello,2.20,20140523,123.45,6\r\n"//
+ ",,,,"//
;
final Parser p = DefaultParserFactory.getInstance().newDelimitedParser(new StringReader(cols), ','... |
ba4af91c-5f5a-4974-98f0-ed47fc922958 | 7 | public String toString()
{
final StringBuffer buf = new StringBuffer(30);
buf.append("Busmon.ind ");
if (tstampType == TYPEID_TIMESTAMP_EXT)
buf.append("ext.");
buf.append("timestamp ");
buf.append(tstamp);
buf.append(" seq ").append(getSequenceNumber());
// buf.append(" status 0x").append(Integer.toHe... |
ee0381a4-3f06-4409-8d7b-cb9995415050 | 4 | @Override
public void run() {
try {
String inputQuestion = this.mainForm.getInputQuestion().getText();
if (inputQuestion.equals(VAL)) {// 验证接入
vali();
} else if (inputQuestion.equals(EVENT_CLICK_KEY)){
handleClick();
} else if(inputQuestion.equals(EVENT_VIEW_KEY)){
handleView();
}else ... |
1c9ee2f4-872c-4765-977d-a6eb987bb0c8 | 0 | @Override
public void mouseClicked(MouseEvent e) {
} |
b814c32a-3fea-4999-abaa-2c52b6f222a1 | 8 | public void exit(SimpleFrame frame)
{
File tempFile = new File(frame.fileName);
if(tempFile.exists()) tempFile.delete();
JFileChooser chooser = new JFileChooser();
chooser.setCurrentDirectory(new File("."));
if(frame.getIsChanged())
{
int selection = JOptionPane.showConfirmDialog(null,"Do you w... |
75c8f317-8784-4601-bb0a-d4b646cb5d65 | 8 | @Override
public boolean tick(Tickable ticking, int tickID)
{
if(tickID==Tickable.TICKID_MOB)
{
if((affected!=null)&&(affected instanceof MOB)&&(invoker!=null))
{
final MOB mob=(MOB)affected;
if(((mob.amFollowing()==null)
||(mob.amDead())
||(mob.location()!=invoker.location())))
{
m... |
24a10400-6398-4966-8b6c-e4867c7f4093 | 8 | private JPanel createCSSSettingsPanel()
{
final JPanel jp = new JPanel();
jp.setBorder(default_border);
BoxLayout bl = new BoxLayout(jp, BoxLayout.PAGE_AXIS);
jp.setLayout(bl);
JComponent cp = new JLabel(UIStrings.UI_CSS_NAME_LABEL);
setItemAlignment(cp);
jp.add(cp);
... |
0bebbf4c-6be8-49e4-8e3c-28ee9c5e36b6 | 3 | public String getPositionOfPerson(Person person) {
if (person != null) {
for (Entry<String, Person> entry : castAndCrew.entrySet()) {
if (person.equals(entry.getValue())) {
return entry.getKey();
}
}
}
return "";
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.