method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
65d8df3a-cb99-45eb-8fe9-b71b8b9e27bd | 6 | @EventHandler
public void WolfStrength(EntityDamageByEntityEvent event) {
Entity e = event.getEntity();
Entity damager = event.getDamager();
String world = e.getWorld().getName();
boolean dodged = false;
Random random = new Random();
double randomChance = plugin.getWolfConfig().getDouble("Wolf.Strength.Dod... |
a4d9efbb-af3c-4241-8a1b-d9f315e60d0f | 5 | public static void MovePlayersFromWorld(String sourceWorld,
String destinationWorld, Boolean resetPlayer) {
World wDestWorld = GetWorld(destinationWorld);
World wSrcWorld = GetWorld(sourceWorld);
Location lSpawn = wDestWorld.getSpawnLocation();
List<Player> _players = wSrcWorld.getPlayers();
for (Iterator... |
7de5e059-1ebe-430f-abc2-e3e58b71eeaa | 8 | @Override
public boolean execute(final String sender, final String message,
final IRCChannel channel) {
if (IRC.isOp(channel, sender)) {
final StringBuilder sb = new StringBuilder();
sb.append("As an OP you can use ");
for (final String string : channel.getOpC... |
60c260bd-2e5c-4348-9811-37e765ec4da0 | 6 | @Override
public void update(final GameContainer gc,final int delta) throws SlickException {
Input input = gc.getInput(); //look for keys pressed
if(Math.sqrt(Math.pow( Mouse.getX() - gc.getWidth() + soundButton.getWidth()/2 , 2)
+ Math.pow( Mouse.getY() - gc.getHeight() + soundButto... |
333ffbf7-5994-4473-b113-04bd175ff3a5 | 1 | private boolean large_size_strategy(int[] bowl) {
// the distributions are updated in the beginning in the pass() function
// we don't have to update / initialize again
// Use the updated distribution for the decision-making
System.out.println( "b-score = " + get_bowl_score(bow... |
8efb1083-a5a4-4516-bf11-4e59c2f43258 | 4 | public static void changeMemberName(String name, int memberID){
try {
if(conn == null || conn.isClosed()){
conn = DatabaseConnection.getConnection();
}
} catch (SQLException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
try{
conn.setAutoCommit(fal... |
e68ec2aa-804d-4ddf-8076-ff927a35632c | 8 | private void loadPlugin(String file) throws IOException, ClassNotFoundException {
File path = new File(folder+"/"+file);
// On teste la validité
if(path.exists() == false || path.getAbsolutePath().endsWith(".jar") == false)
return;
// On découpe le nom comme une URL
URL u = path.toURI().toUR... |
eeb7c4ad-b0fc-4050-8952-30d2374add6b | 9 | public void setRecursiveNotDirty()
{
super.setRecursiveNotDirty();
this.isNameDirty = false;
this.isVisibilityDirty = false;
this.isOpenDirty = false;
this.isAddressDirty = false;
this.isPhoneNumberDirty = false;
this.isSnippetDirty = false;
this.isDes... |
f41276e8-f9ba-4074-8086-3a7854d469ab | 5 | void generateNote() {
if (value == 0)
return;
if (n < 0) {
n = -n;
d = 1;
} else if (d < 0) {
d = -d;
} else if (d == 0) {
d = 1;
}
final AbcNote note = new AbcNote(value, n, d, modifiers);
modifiers.setLength(0);
if (chord == null)
notes.add(note);
else
chord.not... |
77b16118-5b8a-4717-a763-1b3a1957d209 | 7 | Frontier prepareMessage(ConstraintSet constraintSet, InGroupablesStack inGroupablesStack) {
final Arrow graphic = createArrow();
final double arrowYStartLevel = graphic.getArrowYStartLevel(getStringBounder());
final double arrowYEndLevel = graphic.getArrowYEndLevel(getStringBounder());
// final double delta1 =... |
514c815b-6482-4ff8-8f8a-74499e9eaf5f | 8 | private void printMonthlyReport() {
int maxRevenueDay=0;
int minRevenueDay=0;
double totalRevenue = 0;
Scanner sc = new Scanner(System.in);
System.out.print("Please enter the date(MM/YYYY):");
String dateStr = sc.next();
//dateStr = "11/2014";
String[]... |
535b57ca-0fa3-4e6b-a387-d67ad281b98f | 3 | public void buyIn(){
for(int i=1;i<=numPlayers;i++){
System.out.println("Player " + (i) + ", enter your buy in (" + minBuyIn + " - " + maxBuyIn + ")");
int in = Integer.parseInt(input.nextLine());
while(in > maxBuyIn || in < minBuyIn){
System.out.println("Invalid amount, try again");
in = Integer.par... |
c96a188a-42a0-48d4-b493-5904d44536ff | 9 | static StreamTask jsonToTask(JSONObject taskJson) throws StreamIOException {
try {
String taskName = taskJson.getString(TaskKey.NAME);
StreamTask task = new StreamTask(taskName);
if (taskJson.has(TaskKey.DESCRIPTION)) {
task.setDescription(taskJson.getString(TaskKey.DESCRIPTION));
}
if (taskJson.h... |
2be5d8f7-3cc7-4b3d-9897-29fc1f346f58 | 0 | public void moveBack(int x, int y)
{
int newX = this.GetX() + x;
int newY = this.GetY() + y;
this.SetX(newX);
this.SetY(newY);
} |
2ba19ea0-30c7-4228-a7b3-6fd86d367e07 | 4 | private boolean shouldWait() {
//guy that going home has less priority
if (!isGoingHome()) { return false; }
for (Policeman colleague : mPoliceStation.getWalkingOfficers()) {
if (Field.areNear(this, colleague) && !colleague.isGoingHome()) {
return true;
}
... |
b4fdc3ef-c109-426f-8da2-139f7fbd3b10 | 4 | @Override
public boolean equals(Object obj) {
if (!(obj instanceof StrokeMessage))
return false;
StrokeMessage other = (StrokeMessage) obj;
if (this.id == other.id && this.drawable.equals(other.drawable) && this.whiteboardID.equals(other.whiteboardID))
return true;
... |
aa76ad9c-3906-4398-b5fc-32e7419dd329 | 1 | private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {
currentRound++;
jLabel7.setText(g.makeThrow(0));
jLabel3.setText(g.getScore());
jLabel6.setText(g.getPredictedThrow());
if(currentRound == numberOfThrows) {
JOptionPane.showMessageDialog(this, "Final Sco... |
a76a49f1-5d27-433f-80ef-c3c270ba24f4 | 6 | public static Credentials loadCredentials(String aFile) {
Credentials cre = null;
try {
FileInputStream fileIn = new FileInputStream(aFile);
ObjectInputStream in = new ObjectInputStream(fileIn);
Object obj = in.readObject();
if (obj instanceof DBCredent... |
5b4f0f95-ac3e-4ee7-a4f2-d37d819d1c43 | 4 | private int GetKey(){
boolean crypt = catalogue.GetCrypt(Tabid);
boolean comp = catalogue.GetComp(Tabid);
if(!crypt && !comp){
return 0;
}
else if(!crypt){
return 1;
}
else if(!comp){
return 2;
}
else{
... |
4119d0d4-8f81-4a75-a847-9217540f0682 | 3 | public void addUser(User user) {
if (userList.contains(user))
return;
if (!hasSeen(user.getUserID()))
hasSeen.add(user.getUserID());
user.setRank(getRank(user));
if (fileManager != null)
user.save(fileManager);
userList.add(user);
} |
06ca7fc7-eed3-409f-96ab-1b03c1afea59 | 4 | @Override
public ResultSet executeQuery(String sql) throws SQLException, MySQLException {
if((sql == null) || (sql.length() == 0)) { throw new MySQLException("MyConnection.executeQuery() appERROR sql == null or length 0");}
if(statement == null) { throw new MySQLException("MyConnection.executeQuery() appERROR: sta... |
34ce5324-a497-4b65-8377-2bca1e8d0350 | 8 | private BufferedImage filter( BufferedImage src, BufferedImage dst ) {
int width = src.getWidth();
int height = src.getHeight();
//int type = src.getType();
//WritableRaster srcRaster = src.getRaster();
originalSpace = new Rectangle(0, 0, width, height);
transformedSpace... |
985d8f8c-64e0-4315-a989-14a79f06b259 | 9 | public boolean swiftLeft(int idUser, boolean pickup) {
int passengers = 0;
int i = 0, j = 0;
Action a;
Action n = new Action(idUser, pickup);
for (i = 0; i < size(); ++i) { //Encontrar la acción
a = get(i);
if (a.idUser == idUser && a.isPickup == pickup) break;
else if (a.isPickup) ++passen... |
65f9d446-bfa5-45d8-a44c-f18d1725621d | 4 | private void retireAnnotatedRefsetMember(RefexChronicleBI<?> memberChron) throws ContradictionException, IOException, InvalidCAB {
RefexVersionBI<?> mem = memberChron.getVersion(vc);
RefexCAB bp = mem.makeBlueprint(vc, IdDirective.PRESERVE, RefexDirective.INCLUDE);
if (bp.getMemberUUID() == null) {
bp.setMemb... |
dbc17d1c-a1fc-485e-a168-bd2549777a7a | 7 | private void highlightComment(
FragmentHighlighter highlighter,
String text,
int relStart,
int relEnd)
{
int relCommentStart = relStart;
int relCommentEnd = relEnd;
//Find the start position of a non-white space sequence.
while... |
1d2205e1-46eb-45c2-8ac4-14b491f3e356 | 2 | public static String displayHelp()
{
String url = UPDATE_URL;
{
Locale locale;
Serializable record = MyPreferences.get("locale");
if (record != null)
locale = (Locale) record;
else
locale = Locale.getDefault();
url += "?lg=" + locale.getLanguage();
}
try {
Desktop.getDesktop().browse(... |
5af50038-d3ed-4b87-8268-efcc75c4537f | 6 | @SuppressWarnings({ "rawtypes" })
private static List<Class> findClasses(File directory, String packageName)
throws ClassNotFoundException
{
List<Class> classes = new ArrayList<Class>();
if (!directory.exists()) {
return classes;
}
File[] files = directory.listFiles();
for (File file : files) {
St... |
7724e004-9666-4982-ad9a-b4a4f1c35c89 | 0 | @Test
public void itShouldSerialize() throws Exception
{
Polygon polygon = new Polygon(MockData.EXTERNAL);
assertEquals("{\"coordinates\":"
+ "[[[100.0,0.0],[101.0,0.0],[101.0,1.0],[100.0,1.0],[100.0,0.0]]],\"type\":\"Polygon\"}",
mapper.toJson(polygon));
} |
5c206cc8-ad3d-4118-b772-fe10529f3699 | 7 | private static void creatureSpecificInit(EntityLiving par0EntityLiving, World par1World, float par2, float par3, float par4)
{
if (ForgeHooks.onEntitySpawnSpecial(par0EntityLiving, par1World, par2, par3, par4))
{
return;
}
if (par0EntityLiving instanceof EntitySpider && ... |
91092403-8517-496a-9ccd-a05da732ca9a | 8 | final public void Expression() throws ParseException {
/*@bgen(jjtree) Expression */
SimpleNode jjtn000 = new SimpleNode(JJTEXPRESSION);
boolean jjtc000 = true;
jjtree.openNodeScope(jjtn000);
jjtn000.jjtSetFirstToken(getToken(1));
try {
Arithmetic_expression();
} catch (Throwabl... |
2e808cc2-0a83-4d39-aeee-e9bf5f41bbc2 | 7 | public static void main(String[] args)
throws NumberFormatException, InterruptedException {
// Options
double theSpeed = 50.0;
boolean useHackerPanel = false;
double freakShowProbability = 0.00333333; // Once a minute
// Read options
for(int i = 0; i < args.length; i++) {
if (args[... |
05a75e46-dec4-4462-9f7b-90099f925071 | 4 | public void trigger(){
camera.setTrigger(this);
camera.zoom(zoom);
if(camera.getCharacter()==null)
camera.setCharacter(main.character);
if(b2dCam.getCharacter()==null)
b2dCam.setCharacter(main.character);
b2dCam.setTrigger(this);
b2dCam.instantZoom(zoom);
if (Vars.isNumeric(focus)){
String[... |
882cd4cd-66c9-4ea1-ba1a-4938f8253c23 | 1 | public ResultSet getList(String whereString) {
StringBuffer sql = new StringBuffer("");
sql.append("SELECT SSQ.Question_ID,SSQ.SubSection_ID, Q.QType_ID");
sql.append(" FROM SubSectionQuestion AS SSQ");
sql.append(" LEFT JOIN Question AS Q ON SSQ.Question_ID = Q.Question_ID ");
... |
90424fb8-c735-4520-a642-9602635e1d76 | 9 | static final String method250(int i, boolean bool, int i_0_) {
if (bool != true)
method251((byte) 96);
anInt8641++;
int i_1_ = -i_0_ + i;
if ((i_1_ ^ 0xffffffff) > 8)
return "<col=ff0000>";
if (i_1_ < -6)
return "<col=ff3000>";
if ((i_1_ ^ 0xffffffff) > 2)
return "<col=ff7000>";
if ((i_1_ ^ 0... |
9957175f-a11f-46d6-be39-b5c7d174517f | 2 | public void initialise() {
image = new BufferedImage(this.getWidth(), this.getHeight(),
BufferedImage.TYPE_INT_RGB);
int white = Color.white.getRGB();
for (int i = 0; i < this.getWidth(); i++) {
for (int j = 0; j < this.getHeight(); j++) {
image.setRGB(i, j, white);
}
}
} |
cd3f0ed4-e66d-4e8a-9b4b-48aef8f89691 | 4 | final void method100ms() {
long timeMillis = System.currentTimeMillis();
while (true) {
if (System.currentTimeMillis() > timeMillis + 100)
return;
for (int i = 0; i < 10_000; i++) {
// busy wait
if (i == 10_000)
break;
}
}
} |
f436f89d-5c4d-4997-8b0a-130d92425ed5 | 1 | public User getUserByLogin(String login){
Criteria req = this.session.createCriteria(User.class)
.setMaxResults(1)
.add(Restrictions.eq("login", login)) ;
@SuppressWarnings("unchecked")
List<User> users = (List<User>)req.list();
return users.isEmpty() ? null : users.get(0);
} |
abca451e-979d-4568-a3eb-df62dda4ee87 | 8 | private void getFirstDate()
{
int dayOfWeek;
dayOfWeek = calendar.get( Calendar.DAY_OF_WEEK );
switch ( dayOfWeek )
{
case 1:
case 2:
case 3:
case 4:
calendar.add( Calendar.DAY_OF_WEEK, 2 );
break;
case 5:
case 6:
calendar.add( Calendar.DAY_... |
e90e9dce-47bd-450e-b4cb-24634c900d41 | 9 | private DataModelGenerator getDataModelIfReadyToGenerate () {
long lastStart = 0;
DataModelGenerator lastDmg=null;
if ((-1 != staller) && (staller != id)) return null;
// Determine most recent running worker's dmg.
for (int i=0; (i < instances.length); ++i) {
DataModelGenerator d = instances... |
1a15f40c-64d8-4889-826f-24fc42ae5946 | 0 | public long getId() {
return Id;
} |
669bf125-8565-48f3-9487-e9f5abfbb8e4 | 4 | CtClass checkNotExists(String classname) {
CtClass clazz = getCached(classname);
if (clazz == null)
if (!childFirstLookup && parent != null) {
try {
clazz = parent.get0(classname, true);
}
catch (NotFoundException e) {}
... |
11dee95a-9f39-4d6a-93f9-544abc9d4e7a | 4 | public void addObject(ConstructsCollection collection) {
String constructQueryResult = Queries.queryFindConstructs(dataset);
wordArray = getResultList(constructQueryResult);
for (String index : wordArray) {
String resultTransformation = Queries
.queryFindTransformationConceptRole(index.trim(), dataset);
... |
1308faf2-ac24-493a-ad54-7dc511f58cba | 4 | public void generatePlayField()
{
fieldAreas = new FieldArea[FIELDAREAY][FIELDAREAX];
for(int y = 0; y < FIELDAREAY; y++)
{
for(int x = 0; x < FIELDAREAX; x++)
{
int height = y * FIELDAREAHEIGHT;
int width = x * FIELDAREAWIDTH;
... |
7e66c636-d333-4905-b8da-500540c47004 | 7 | @SuppressWarnings("deprecation")
@EventHandler
public void BlockBreak(BlockBreakEvent event) {
SpoutBlock block = (SpoutBlock) event.getBlock();
if (block.getCustomBlock() == Reciever_Block_off | block.getCustomBlock() == Reciever_Block_on) {
// Remove block from the HashMap
if (block_channel.contains... |
a69d1b25-17a7-4226-95c6-bb50811ee8c3 | 4 | private Element CreateColumnHeaders()
{
Element colHeaders = doc.createElement("headers");
Element header = doc.createElement("col-header");
header.appendChild(doc.createTextNode(dataGrid.getRowDescriptor()));
colHeaders.appendChild(header);
int cndx = 0;
... |
3ac72fd1-3ed3-40a3-806e-a07e5f3d609a | 6 | public void addMeetingNotes(int id, String text)
{
try
{
if(text.equals(null))
{
throw new NullPointerException();
}
PastMeetingImpl pMeeting = (PastMeetingImpl) getMeeting(id); //downcast Meeting as PastMeetingImpl
if(pMeeting.equals(null))
{
throw new IllegalArgumentException();
... |
f68f682b-b298-4246-8450-8425399c4be2 | 0 | public void testInitial2UpperCase() {
String value = "Abcde";
assertEquals(value,
StringUtils.changeFirstCharacterCapitalized(value, true));
value = "abcde";
assertEquals("Abcde",
StringUtils.changeFirstCharacterCapitalized(value, true));
value = "中国";
assertEquals(value,
StringUtils.changeFir... |
d2510de4-2767-4a3d-931f-078bad9074d1 | 5 | private void loadfile(String csvFile) {
try(BufferedReader fReader = new BufferedReader(new FileReader(csvFile))
) {
String data = "";
while((data = fReader.readLine()) != null) {
String[] values = data.split(",");
double _value = Double.parseDouble(values[2]);
if ((minFreq <= _value) && (_value... |
63795724-fac0-417f-a736-9425afdf8e28 | 9 | private AVLNode helperInsert(AVLNode n, E data){
if(n == null){
n = new AVLNode(data);
}else{
// compare the new data with the data at the current node
int cmp = comparator.compare(data, n.data);
if(cmp == 0) { // a. Current node is a match
n.count++;
}else if(cmp < 0){
n.left = he... |
b90a439a-48f2-4a79-8fa7-c883686c0912 | 8 | public CalendarDate encodeCalendarDate() {
{ DecodedDateTime timeStructure = this;
return (CalendarDate.makeDateTime(((timeStructure.dateTimeYear != Stella.NULL_INTEGER) ? timeStructure.dateTimeYear : Stella.$DEFAULT_DECODED_DATE_TIME$.dateTimeYear), ((timeStructure.dateTimeMonth != Stella.NULL_INTEGER) ? ti... |
c467d58b-d5ca-4219-81ea-2836b8becc8d | 0 | @Override
public String getStrategyName() {
// TODO Auto-generated method stub
return "平均策略";
} |
b10598b6-4349-4088-8137-8c5c7997621f | 3 | public void set(int x, int y, int value){
if (board[x][y].get_value()==EMPTY_PIECE){
board[x][y].set_value(value);
n_cell++;
if (value == WHITE_PIECE) ++WHITE_SCORE;
else ++BLACK_SCORE;
}else if (board[x][y].get_value()==WHITE_PIECE){
board[x][y].set_value(value);
WHITE_SCORE--;
BLACK_SCORE++;
... |
6374209d-e537-4991-b970-406e7c6f2f7b | 1 | public void writePic(String filename, int width, int height, int framesToBeWritten, ArrayList<Picture> picList) {
int widthC = width >> 1;
int heightC = height >> 1;
startWriting(filename, width, widthC);
Picture picTemp;
for (int framesNo = 0; framesNo < framesToBeWritten; framesN... |
24801d8e-6476-4c32-9236-910126643a69 | 8 | public void putAll( Map<? extends Byte, ? extends Byte> map ) {
Iterator<? extends Entry<? extends Byte,? extends Byte>> it =
map.entrySet().iterator();
for ( int i = map.size(); i-- > 0; ) {
Entry<? extends Byte,? extends Byte> e = it.next();
this.put( e.getKey(), e.... |
8912be43-1e34-4b45-8cf9-e368dba2c40d | 2 | public int getTurn()
{
if (currentState == States.PlayerOneTurn)
{
return 1;
}
else if (currentState == States.PlayerTwoTurn)
{
return 2;
}
else
{
return -1;
}
} |
8467f956-e71b-41fc-a081-039254b89e03 | 8 | public CreatureBuilder(ActionBuilder actionBuilder) {
fileParser = new FileParser(KEYS);
this.actionBuilder = actionBuilder;
List<File> files = FileUtils.getFiles(getCreaturesDirectory());
for (File file : files) {
try {
Creature creature = buildCreature((FileUtils.readFile(file)));
String missingKey... |
d0f107c6-8c38-4e31-a185-421d7017c6c5 | 1 | public int getMode() {
Integer i = (Integer) getClientProperty(MODE_PROPERTY);
if (i == null) {
return -1;
}
return i.intValue();
} |
bf9bcdf3-6673-4812-ab2c-80ad232344ca | 5 | private void toPixel3(int[][] matrix, int h, int w) {
for (int i = 0; i < h; i++) {
for (int j = 0; j < w; j++) {
double re = fd[j * h + i].re();
double im = fd[j * h + i].im();
int ii = 0, jj = 0;
int temp = (int) (Math.sqrt(re * re + im * im));
if (temp > 255)
temp = 0;
if (i < h ... |
4ed6eb79-4648-4af3-b2da-0058b5cd0afe | 9 | private List<Mapper> estimateMappers() {
List<Mapper> newMapperList = new ArrayList<Mapper>();
if(isSplitSizeChanged || isMapperConfChanged) {
MapperEstimator mapperEstimator = new MapperEstimator(finishedConf, newConf);
//split size is changed
if(isSplitSizeChanged) {
List<Long> splitsSi... |
bb92bbb8-5d55-454b-a699-7a6d391a33ee | 4 | public void updateCourse(int courseId, String courseCode, String name) {
if(!isValidId(courseId) || courseCode.length() == 0
|| name.length() == 0) {
return;
}
Course course = courseDao.getCourse(courseId);
if(course != null) {
course.setCourseCode(courseCode);
course.setName(name);
course... |
3689ab0e-fa30-4bec-805e-56b922e065e8 | 1 | private static Image addImpulseNoise(Image image, double sp, double pp) {
if (image == null)
return null;
Noise filter = new Noise();
filter.setNoiseType(Noise.IMPULSE_NOISE_TYPE);
filter.setSaltProbability(sp);
filter.setPepperProbability(pp);
Image image2 = filter.filter(image);
return image2;
} |
c59cfa7b-033b-4a9e-a4d9-d89027cd0d92 | 3 | @Override
public void onRepaint(Graphics g) {
try {
for(final int i : Skills.getExperiences()) {
totalXP += i;
}
currCount = totalXP;
totalXP = 0;
if(lastCount != currCount) {
pocketed++;
}
lastCount... |
41d26a28-8328-4c6c-93c5-56869036eeaa | 8 | public boolean isInit(SERVICE service){
boolean isInit = false;
switch(service){
case CONNECTION_SERVICE :
if(connectionManager != null)
isInit = true;
break;
case CHANNEL_SERVICE :
if(channelManager != null)
isInit = true;
break;
case REQUEST_SERVICE :
if(requestManager !=... |
65b00860-480c-4218-9571-4c22ecc43d7a | 4 | @Event
public void spawnBee() {
if (hasTooMuchInfectedBees()) {
infoWithPosition("I am collapsed!");
_infected = true;
return;
}
if (_populationCapacity > _currentPopulation) {
boolean newBeeIsWorker = _currentWorkerBeePopulation < _currentPopulation * WORKER_BEE_PERCENTAGE;
Bee newBee = _simulati... |
5e964b9d-1086-490a-ab61-279fc309d9df | 9 | public static void main(String[] args) {
HashMap<Integer, QueryProgress> submittedQueries = new HashMap<>();
try {
String uri = args[0];
Registry registry = LocateRegistry.getRegistry(uri);
System.out.println(registry.list());
QueryService queryService = (QueryService) registry.lookup("query");
... |
9f9e27f4-2955-442f-90e5-a1b219cc7a01 | 3 | public synchronized void drop(Picture dropPicture)
{
Graphics2D g2 = null;
// only do this if drawing on a picture
if (picture != null)
g2 = (Graphics2D) picture.getGraphics();
else if (modelDisplay != null)
g2 = (Graphics2D) modelDisplay.getGraphics();
// if g2 isn't null
... |
0e43825e-2190-4d97-9e95-e5738f93ebc5 | 6 | public void actionPerformed(ActionEvent e)
{
if(e.getSource() instanceof JTextField) // if you entered a new value in a text field
{
JTextField textField = (JTextField)e.getSource();
if(textField.getName().equals("tempField"))
{
tempSlider.setValue((int)Double.parseDouble(textField.getText())); ... |
e1a64df8-a4ef-4cc3-824c-a8cc6f23a97a | 3 | public synchronized static String translateToString(DiceHand hand) {
String returnMsg = "";
// add the rollee
returnMsg += ROLLEE_IDENTIFIER + VAL_SEP + hand.getRollee() + ELEMENT_SEP;
// place on the modifier if it's not zero
if (hand.getModifier() != 0) {
returnMsg ... |
9a42fd00-388f-4eba-9e2b-96d1d635f84b | 5 | public static long getLong(byte[] b, int offset) {
if (isBlank(b)) {
throw new IllegalArgumentException("blank byte array.");
}
if (offset < 0) {
throw new IllegalArgumentException("invalid array offset:" + offset + ".");
}
long out = b[0] < 0 ? -1L : 0L;
for (int l = b.length - offset, i = l < LONG_B... |
c6c2f4ef-c653-45a9-91fe-e1032e371eda | 2 | @Override
public void Consultar() throws SQLException
{
try
{
Conexion.GetInstancia().Conectar();
ResultSet rs = Conexion.GetInstancia().EjecutarConsulta("SELECT Id_Bodega,Id_Sucursal,Nom_Bodega,Des_Bodega,Ext_Bodega FROM Bodega WHERE Cod_Bodega ='"+ObBodega.getCod_Bodeg... |
e4087f68-c268-4044-b0cc-1f356df255bc | 4 | public float check (int color) {
sum = 0;
div = 0;
if (checkRed) {
div++;
sum += (color >> 16) & 0xFF;
}
if (checkGreen) {
div++;
sum += (color >> 8) & 0xFF;
}
if (checkBlue) {
div++;
sum += ... |
a3f160bc-db85-4e5e-96ac-71c2af62037d | 3 | public void loadLeadSpelprojekt() {
PanelHelper.cleanPanel(spelprojektHolder);
Dimension d = spelprojektHolder.getPreferredSize();
d.setSize(360, 10);
spelprojektHolder.setPreferredSize(d);
ArrayList<String> a1 = null;
try {
a1 = DB.fetchColumn("select SID fro... |
73907963-60a1-4794-a9de-b0210abe155d | 4 | private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {
// 追加一段协议内容
String key = jTextField2.getText().trim();
if (StringUtils.isEmpty(key)) {
MessageBox.showConfirmBox(this, "Error", "键不能为空", null);
return;
}
if (!StringUtils.isEng... |
b1005a65-1cb8-4f3c-a364-0e709f65c3e2 | 1 | public void setCanBeAvail(final boolean flag) {
if (StackPRE.DEBUG) {
System.out.println(this + " CBA = " + flag);
}
canBeAvail = flag;
} |
f554214e-b05a-4df3-9836-de9b33078a81 | 6 | public String solve() {
int sum = 0;
Set<Integer> abundantSet = new HashSet<Integer>();
Set<Integer> possibleSum = new HashSet<Integer>();
for(int i = 12; i < 28123; i++) {
if(isAbundant(i)) {
abundantSet.add(i);
}
}
for(Integer num1 : abundantSet) {
for(Integer num2 : abundantSet) {
pos... |
6025a328-b3c4-4c26-bcc8-c31105e5a318 | 7 | @Action
public void Delete() {int c =0;
JPasswordField pf = new JPasswordField();
JOptionPane.showConfirmDialog(null, pf, "Enter Password(max 6 char)", JOptionPane.OK_CANCEL_OPTION, JOptionPane.PLAIN_MESSAGE);
String pass = new String(pf.getPassword());
try
{
BufferedReader br = new BufferedRe... |
9cf48f55-e8ad-4be3-b24e-2f17213e16a0 | 6 | RandomWeighted(int[] weights) {
random = new Random();
totalWeight = 0;
if (weights.length == 0)
useWeighted = false;
else {
maxDivisor = findMaxDivisor(weights);
String s = String.valueOf(maxDivisor);
maxDivisorLength = (byte) s.length();
table = new int[maxDivisorLength][];
radixS... |
991ca8c3-8634-4620-8c5c-b26eae84b19c | 4 | public void escribeArchivoINST(int lin, String etq, String cod, String ope, BufferedWriter bw){
String line;
line = Integer.toString(lin);
try{
bw.write(line);
bw.write("\t ");
if(etq.isEmpty())
bw.write("Null");
else
bw.write(etq);
bw.writ... |
5c464754-cde4-4d36-9b17-6ac2c20a53e2 | 6 | public void ActivateCognitiveGraph(String symbol, int type){
if(CognitiveGraph.size()==1){//判断是不是分析过程中出现的第一个对象
if(CognitiveGraph.get(0).ObjOrAttri.get(0).Symbol.equals("")){
CognitiveGraph.get(0).ObjOrAttri.get(0).Symbol=symbol;
CognitiveGraph.get(0).ObjOrAttri.get(0).OriginalType=type;
}
}
else{//... |
70e34100-edea-4801-96ff-f6a11463f5ec | 6 | public List<Book> findBook(String searchKey, String searchText) {
List<Book> bookList = new ArrayList<Book>();
String key = "";
// SQL-Tabellenspalte
if (searchKey == "Autor") {
key = "author";
} else if (searchKey == "Buchtitel") {
key = "title";
} else if (searchKey == "Kategorie") {
key = "cat... |
266d8d5c-8020-4f9a-9f31-836bf47b27bd | 9 | private boolean init(boolean shouldExist) throws Exception {
// Expand any variables in the filename
if (!expandVariable())
return false;
// This is not that elegant code, but the org.eclipse.core.filesystem.URIUtil.toURI
// from the string returned wrong path (appended the install path), and java.net.... |
fcbe886d-dad0-4fe1-ad7f-f1f492fc6c4a | 4 | private int placeFinder(int ID, ArrayList<TeamObject> count) {
int size = (count.size()-1);
if (size == 0) {
return 0;
} else {
try {
for (int c = 0; c <= size; c++) {
if ((count.get(c... |
2f8599a6-144e-433d-84ce-6252df48bd1d | 6 | public void Animate() {
switch (doorstate) {
case 0: // Do nothing
break;
case 1:
room.SetMaterial(15, 5, 0);
doorstate++;
break;
case 2:
room.SetMaterial(15, 4, 0);
doorstate++;
... |
c0d1a0c8-64d4-4034-972d-0427dccee3f8 | 9 | static protected void FillBuff() throws java.io.IOException
{
if (maxNextCharInd == available)
{
if (available == bufsize)
{
if (tokenBegin > 2048)
{
bufpos = maxNextCharInd = 0;
available = tokenBegin;
}
else if (tokenB... |
f9ef5f5e-ec70-403c-8154-ec5dba1c2828 | 6 | @Override
public void render() {
RenderAssistant.renderContainer(x, y, width + 20, height + 20, doubled);
if (text.length() == 0 && hint.length() > 0) {
glColor4f(0.5f, 0.5f, 0.5f, 0.5f);
RenderAssistant.renderText(x + 15, y + 13, hint, font);
}
glColor3f(1, 1, 1);
if (!enabled) glColor3f(0.6f, 0.6f, 0... |
11703492-1bc6-47ae-aa40-27d8dd45b4e7 | 8 | public static HashMap<String, String> parseParam(String[] args) {
HashMap<String, String> paraMap = new HashMap<String, String>();
String currentParaName = null;
if (args != null && args.length > 0) {
int index = 0;
while (index < args.length) {
String pa... |
e873d0c5-38bf-4daf-a976-4386d9a0fdf4 | 6 | public JSONObject countCollectionColorsColors(Color[] colors, float[] weights, Color[] countColors)
throws TinEyeServiceException
{
MultipartEntity postEntity = new MultipartEntity();
JSONObject responseJSON = null;
if (weights.length > 0 && colors.length != weights.length)
... |
a965e643-357b-4bec-b48d-1a8584227628 | 2 | public void createTable() throws SQLException {
stmt.execute("drop table " + tableName);
stmt.execute("create table " + tableName + " (key int, value string)");
// show tables
String sql = "show tables '" + tableName + "'";
System.out.println("Running: " + sql);
ResultSet... |
b8c55104-5b58-4778-a2c4-705a8666ee2c | 3 | public Command getCmdFromIdent(String ident, CommandSender sender) {
if (this.identifiers.get(ident.toLowerCase()) == null) {
for (Command cmd : this.commands.values()) {
if (cmd.isIdentifier(sender, ident)) {
return cmd;
}
}
}
return (Command)this.identifiers.get(ident.toLowerCase());
} |
deb50669-5b71-4ab2-8e68-34d5b8e3dcb0 | 8 | public boolean validateOntology(String ontologyPath) throws Exception {
log.debug("[OntologyValidator::validateOntology] BEGIN");
boolean result = false;
try {
OWLOntologyManager manager = OWLManager.createOWLOntologyManager();
File file = new File(ontologyPath);
... |
77e99e54-e1e9-4172-9e16-6b4e01be4cc8 | 5 | private final void method2276(int i, ByteBuffer class348_sub49,
int i_3_) {
if (i_3_ == 1)
((Class300) this).anInt3817 = class348_sub49.getShort();
else if ((i_3_ ^ 0xffffffff) != -3) {
if (i_3_ == 3)
((Class300) this).anInt3823 = class348_sub49.getUByte();
} else {
((Class300) this).anIntArra... |
110a2fa5-9e68-45b0-8c4f-db407788c879 | 9 | @Override
public void run() {
final Component shop = ctx.widgets.component(WIDGET_SHOP, WIDGET_SHOP_WATER_TALISMAN);
if (shop.valid()) {
if (shop.interact("Buy X", "Water talisman")) {
if (Condition.wait(new Callable<Boolean>() {
@Override
public Boolean call() throws Exception {
return ctx.... |
04005a6e-1556-47e7-a358-a3d43fde5169 | 3 | public void sortMatrixOnFirst() {
for (int i = 0; i < column.length; i++) {
for (int j = 1; j < column.length; j++) {
if (column[j].top() < column[j - 1].top()) {
StackElement help = column[j].getHead();
column[j].setNewHead(column[j - 1].getHe... |
fc0732f8-4390-4c63-b770-8f522024f0d5 | 3 | public synchronized void operateEntities(double p){
period = p;
/////////////////////////////////
// main entity loop //
/////////////////////////////////
playerArrayList = new ArrayList<int[]>();
//loops through every entity to perform operations on
for(int i=0; i<playerList.size()... |
7230b5aa-097e-410f-abd0-3cd503c32df9 | 5 | public MethodVisitor visitMethod(
final int access,
final String name,
final String desc,
final String signature,
final String[] exceptions)
{
if (computeSVUID) {
if ("<clinit>".equals(name)) {
hasStaticInitializer = true;
}
... |
7f170697-0578-4a19-a7f2-231f3dd38eba | 8 | private void antialias(int ch, int gr) {
int sb18, ss, sb18lim;
GrInfo gi = si.ch[ch].gr[gr];
// 31 alias-reduction operations between each pair of sub-bands
// with 8 butterflies between each pair
if (gi.windowSwitching && (gi.blockType == 2) && !gi.mixedBlock) {
ret... |
020fb69a-c77e-4036-89ae-3d26464ba57f | 1 | private boolean jj_3R_47() {
if (jj_3R_58()) return true;
return false;
} |
f61e80d5-9f38-4671-932e-80e856cadbf1 | 9 | @Override
public boolean equals(final Object other) {
if (other == this) {
return true;
} else if (other != null && other.getClass().equals(this.getClass())) {
final Identifier him = (Identifier)other;
final Object value = this.getValue();
if (value == null) {
if (him.getValue... |
32bec27c-784e-4a25-84d0-557ca5da4acb | 2 | public static String toPrettyString(Object obj) {
if (obj instanceof String) {
return "\"" + obj.toString() + "\"";
} else if (obj instanceof CycList) {
return ((CycList) obj).toPrettyString("");
}
return obj.toString();
} |
e151c04b-c58f-4802-adb0-70ed6588fb8d | 0 | public Feet(float i) {
this.quantity = i;
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.