method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
36622588-ca1a-46fa-8ad1-f241f7a5eb5e | 9 | public void generate(int i, int j, int type, int ori){
if (type==0){
if (map[i][j] == suelo)
map[i][j] = obstacle0;
}else if (type==1){
if (ori == 0 && map[i][j] == suelo && map[i+1][j] == suelo){
map[i][j] = obstacle10;
map[i+1][j]... |
c6d525f8-e91c-43a7-a4f4-8ab863888623 | 7 | @Override
public void paintComponent(Graphics g)
{
g.clearRect(0, 0, getWidth(), getHeight());
for (int row = 0; row < board.getRows(); ++row)
{
for (int col = 0; col < board.getColumns(); ++col)
{
int r = board.getHeroLocation().getLocation().x;
int c = board.getHeroLocation(... |
9aa808a7-0b9f-4e60-a7f8-764df3800713 | 3 | @Override
public void update(Observable arg0, Object arg1) {
if(arg0.equals(model)){
while(tmodel.getRowCount() > 0){
tmodel.removeRow(0);
}
Vector<String> productVector;
Product p;
Iterator<fpt.com.Product> productIterator = model.iterator();
while(productIterator.hasNext()) {
productVect... |
4abcaa31-ea14-40b3-a4a3-a5f29a0e8482 | 6 | public void printShuffle(Graphics g) {
int q = 0;
int z = 250;
String cardName = null;
for (int i = 0; i < deck.length; i++) {
if (deck[i].cardValue == 0) {
cardName = "A" + deck[i].suit;
} else if (deck[i].cardValue == 11) {
cardName = "J" + deck[i].suit;
} else if (deck[i].cardValue == 12... |
88a15afa-7331-42c6-9176-716feee48eee | 5 | @Override
public void initialize(URL location, ResourceBundle resources) {
final WebEngine engine = webViewAuth.getEngine();
try {
engine.load(Auth.getUrl(Constants.APP_ID, Auth.getSettings()));
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
... |
dc5d898a-28b1-4df4-bceb-faf31cbabc2d | 5 | @Override
public Boolean StartApplainceCycle(String said)
{
//TODO Auto-generated method stub
for (ArrayentBackEndCommunication app : _applainces)
{
if(app._applInstance.get_said()== said)
{
try
{
if(app._applInstance.get_isApplianceInitialized() && !app._applInstance.get_isCycleStarted()... |
324b495c-981b-45ae-af70-b37eb1eda6e8 | 2 | public int pickLvl()
{
int throwAway = (int)(Math.random()*4+baseLevel-2);
if(throwAway<5)
return 5;
else if(throwAway>100)
return 100;
else
return throwAway;
} |
bc7d240a-6048-4a8a-ac9f-abdb0d7693e5 | 2 | @Override
public void init(GameContainer gc, StateBasedGame sbg) throws SlickException {
ImageData.getInstance().initialize();
categories = ImageData.getInstance().getCategories();
elements = ImageData.getInstance().getElements();
backgroundSheet = new SpriteSheet("res/anims/background/Light.png", 560, 420);
... |
48f3e9af-af1c-4bc2-8356-1b18f84d4dc6 | 1 | private void registerTasks(Environment environment) {
final Map<String, Task> beansOfType = applicationContext.getBeansOfType(Task.class);
for (String beanName : beansOfType.keySet()) {
Task task = beansOfType.get(beanName);
environment.admin().addTask(task);
logg... |
578c31bf-11f4-4d38-a4c4-d2f9b4c944e9 | 2 | private void jMenu3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenu3ActionPerformed
if (jRadioButtonMenuItem1.isSelected()) {
try {
byte[] encodeBase64Chunked = Base64.decodeBase64(jTextArea1.getText().getBytes("UTF-8"));
jTextArea1.setText(new... |
8ccd15f9-f5ca-4510-945d-5eb0c6bfd6a4 | 6 | * @return Stella_Object
*/
public static Stella_Object unassert(Stella_Object proposition) {
{ Cons parsedprops = Logic.updateProposition(proposition, Logic.KWD_CONCEIVE);
Cons result = Stella.NIL;
if (parsedprops != null) {
{ Proposition prop = null;
Cons iter000 = parsedprops;
... |
6ae1e0ed-1431-4052-97fc-17090d6cf765 | 9 | @Override
public void unInvoke()
{
// undo the affects of this spell
if(!(affected instanceof MOB))
return;
final MOB mob=(MOB)affected;
super.unInvoke();
if((canBeUninvoked())&&(mob.location()!=null))
{
if((failed)||(!CMLib.flags().isSitting(mob))||(room==null)||(title==null)||(mob.location()!=roo... |
e345536f-30c2-4ad9-8390-b79407917c27 | 4 | private void writeInputs(PrintWriter out) {
int curCycle = cycleOffset;
for (PlaybackOperation op : playback) {
for (Entry<Integer, Integer> input : op.getInputMap().entrySet()) {
boolean frameBoundary = curCycle + input.getKey() >= FRAME_CYCLES;
if (frameBoundary) {
curCycle -= ... |
8e07e01e-06b0-44e2-a987-94492fa25869 | 7 | private void calculateMinRequiredNumber(GameDescription game){
ArrayList<SpriteData> allSprites = game.getAllSpriteData();
for(SpriteData sprite:allSprites){
if(!sprite.type.equals(resource) && checkIsCreate(sprite.name, game, allSprites)){
minRequiredNumber.put(sprite.name, 0);
}
else{
if(getAl... |
89d8e592-31a5-4563-9e28-f3d334089f4f | 7 | @Override
public String execute() throws Exception {
try {
Map session = ActionContext.getContext().getSession();
Campaign camp = (Campaign) session.get("campa");
Long campid = camp.getCampaignId();
// System.out.println("Camp is" + camp.toString());
... |
9fcc3b6c-d4cc-4a88-afaf-0bd1a57b95a4 | 4 | @Override
public void onDraw(Graphics G, int viewX, int viewY) {
if (X>viewX&&X<viewX+300&&Y>viewY&&Y<viewY+300)
{
G.setColor(Color.gray);
G.fillRect((int)X-2-viewX, (int)Y-32-viewY, 4, 32);
G.setColor(Color.darkGray);
G.fillRect((int)X-16-viewX, (int)... |
c2424b5e-7273-4d0c-b4dc-96fe774273e3 | 0 | private SettingsManager() {
} |
cb8c0cc8-c074-4612-9904-08c5ace25434 | 1 | public static void triggerTraySelectionChanged() {
for (TraySelectionChangedListener listener : StorageUnitDisplayPanel.traySelectionChangedListeners) {
listener.onTraySelectionChanged();
}
} |
4bf09bc2-5b7d-4c1a-8cfb-1031e2e46b8a | 9 | @SuppressWarnings("unchecked")
private static Number instantiateNumber(Class<? extends Number> cls,
String number) {
assert cls != null : "The class may not be null";
if (number == null || number.isEmpty()) {
return null;
}
try {
Constructor<Number> numberConstructor = (Constructor<Number>) cls
... |
3841b3d7-1f85-4dda-a4bd-78e16e192efe | 9 | private void checkErrors(JSONObject response) throws UniSenderMethodException, UniSenderInvalidResponseException{
if (response.has("error")){
try {
String errorMsg = response.getString("error");
String code = response.getString("code");
MethodExceptionCode mec = MethodExceptionCode.UNKNOWN;
i... |
4f556617-6781-4f59-8c00-c567e92599f8 | 0 | public void Close() {
this.pconnect.LogOut();
} |
afc60e03-7f72-4b13-9224-3f1d9d279890 | 5 | private void doPaintBucketNoDia(int x, int y, Color newCol, Color currentCol)
{
// make sure it's on the image
if (x > -1 && y > -1 && x < this.getDrawingWidth()
&& y < this.getDrawingHeight()
&& this.getPointColor(x, y).equals(currentCol))
{
this.drawPoin... |
07bcea97-1931-4691-955b-2425b3e27408 | 9 | private int getEarliestCarTime(Parking[] lots, MovingCar[] cars, int i, int dir) {
if (i < 0 || i >= lots.length || lots[i] == null) {
return Integer.MIN_VALUE;
}
if (!lots[i].isEmpty()) {
return lots[i].getFirst();
}
int lastBlock = dir == 1 ? nblocks[i] - 1 : 0;
for (int j = 0; j < cars.length; j+... |
162d49cc-fd41-4da4-a7a3-0471b8a41c18 | 6 | @SuppressWarnings("LoopStatementThatDoesntLoop")
public <B, C> Trampoline<C> zipWith(final Trampoline<B> b, final F2<A, B, C> f) {
final Either<P1<Trampoline<A>>, A> ea = resume();
final Either<P1<Trampoline<B>>, B> eb = b.resume();
for (final P1<Trampoline<A>> x : ea.left()) {
for (final P1<Trampol... |
49c5ae53-1894-4908-8222-daf7ec242016 | 3 | public static void Cliente_Apaga(String nome, InterfaceControlador ic_cliente){
/**Just a Scanner*/
Scanner sc = new Scanner(System.in);
System.out.println("\nDigite o nome do objeto a ser apagado");
nome = sc.next();
try
{
System.out.println("\nProcurando...\n");
ic_cliente.intControladorA... |
635a1762-9a64-4cf2-ab94-da7d53d2e080 | 6 | private SocketChannel accept() {
Socket sock = null;
try {
sock = handle.socket().accept();
} catch (IOException e) {
return null;
}
if (!options.tcp_accept_filters.isEmpty ()) {
boolean matched = false;
for (TcpAddress.Tcp... |
eec7f362-f7ee-4190-ae1e-658db4be0e9b | 2 | private void createButtonsMatrix() {
for (int i = 0; i < bMatrix.length; i++) {
for (int j = 0; j < bMatrix[0].length; j++) {
JButton button = new JButton();
button.setPreferredSize(new Dimension(50, 50));
bMatrix[i][j] = button;
}
... |
30c89de9-1008-4f4b-9725-a2c103572470 | 8 | public void visit_lload(final Instruction inst) {
final int index = ((LocalVariable) inst.operand()).index();
if (index + 2 > maxLocals) {
maxLocals = index + 2;
}
if (inst.useSlow()) {
if (index < 256) {
addOpcode(Opcode.opc_lload);
addByte(index);
} else {
addOpcode(Opcode.opc_wide);
... |
d21ea39c-91b8-4f06-9fe0-64eec183530d | 8 | static int scoreRange(LeafCollector collector, DocIdSetIterator iterator, TwoPhaseIterator twoPhase,
Bits acceptDocs, int currentDoc, int end) throws IOException {
if (twoPhase == null) {
while (currentDoc < end) {
if (acceptDocs == null || acceptDocs.get(currentDoc)) {
colle... |
62d5fa7c-d335-4ff2-acb9-d9ba7ac39c5b | 1 | public boolean more() throws JSONException {
this.next();
if (this.end()) {
return false;
}
this.back();
return true;
} |
0af573ae-3ebe-4920-bdfd-332999b767c1 | 0 | @FXML
private void handleSliderAction() {
threadField.setText(Double.toString((int) threadSlider.getValue()));
numThreads = (int)threadSlider.getValue();
System.out.println((int)threadSlider.getValue());
} |
1a1acd0e-d8f1-4746-b982-d3143c00eaca | 5 | public void loadGameConfigValues() {
if (gameConfigValues.isEmpty()) {
try {
// config values were not loaded yet -> load it
Ini iniFile = new Ini(this.getClass().getResource("/" + LOTDConstants.INI_FILE_PATH_GAME_INI));
Section section = iniFile.get(LOTDConstants.INI_SECTION_GAME_INI_CONFIG_SECTION);
... |
d3fbeeb8-5d03-4e74-9646-2252acae39bc | 3 | private boolean jj_3R_27()
{
if (jj_3R_30()) return true;
Token xsp;
while (true) {
xsp = jj_scanpos;
if (jj_3R_31()) { jj_scanpos = xsp; break; }
}
return false;
} |
e95f7683-26fd-4017-afb9-89151bb013d9 | 9 | public int compareTo( Object obj ) {
if( obj == null ) {
return( 1 );
}
else if( obj instanceof GenKbPhoneByUDescrIdxKey ) {
GenKbPhoneByUDescrIdxKey rhs = (GenKbPhoneByUDescrIdxKey)obj;
if( getRequiredContactId() < rhs.getRequiredContactId() ) {
return( -1 );
}
else if( getRequiredContactId() ... |
5bbb1474-2410-4c40-a124-1a481355beb0 | 9 | public boolean shouldExecute()
{
if (this.targetEntityClass == EntityPlayer.class)
{
if (this.theEntity instanceof EntityTameable && ((EntityTameable)this.theEntity).isTamed())
{
return false;
}
this.field_48240_d = this.theEntity.worl... |
ab62515f-a827-44eb-9586-9b27df77bab7 | 4 | public static void main(String[] args) {
// -------------------------Initialize Job Information------------------------------------
String startJobId = "job_201301191915_0001";
//String startJobId = "job_201212172252_0001";
//String jobName = "uservisits_aggre-pig-256MB";
//String jobName = "SampleWordCountWi... |
68d73712-4bda-4653-8b0c-76b00c2a832d | 3 | protected void processRequest(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
CommentPage commentPage = new CommentPage();
String text = request.getParameter("comment");
if (text == null || text.equals("")) {
co... |
c716fb12-1c16-4048-bb98-8465a11bc1c6 | 9 | public ParseException generateParseException() {
jj_expentries.clear();
boolean[] la1tokens = new boolean[50];
if (jj_kind >= 0) {
la1tokens[jj_kind] = true;
jj_kind = -1;
}
for (int i = 0; i < 0; i++) {
if (jj_la1[i] == jj_gen) {
for (int j = 0; j < 32; j++) {
if... |
0dc4bc43-89f2-475f-a6a4-2e0de05be06a | 7 | public TaskListClientView getTasksForDate(String dateKey) {
PersistenceManager pm = getPersistenceManager();
TaskListClientView result = null;
try {
Query q = pm.newQuery(DateBoundTasks.class, "dateString == ds");
q.declareParameters("java.lang.String ds");
List<DateBoundTasks> tasks = (List<DateBoun... |
d2520465-adca-4c0b-8d21-0b6a3514ebf5 | 6 | public void adjustBeginLineColumn(int newLine, int newCol)
{
int start = tokenBegin;
int len;
if (bufpos >= tokenBegin)
{
len = bufpos - tokenBegin + inBuf + 1;
}
else
{
len = bufsize - tokenBegin + bufpos + 1 + inBuf;
}
int i = 0, j = 0, k = 0;
int nextColDiff = ... |
423d7bdd-2329-4431-b5dc-6bf696cc33a8 | 6 | public void initialise() {
switch( network.type ) {
case GENERAL: initialiseGeneral();
break;
case RANDOM:
initialiseRandom();
break;
case LINE: initialiseLine();
break;
case STAR: initiali... |
227da016-5e2b-4609-aeca-9f56f8fef38f | 9 | private void recursive_move(int count)
{
if(max_backup_files == 0)
{
File file= new File(log_file_path + log_file_name + log_file_ending);
file.delete();
return;
}
if (count == max_backup_files)
return;
File file_from;
... |
cedcdf44-3d5b-4465-9dab-b0aab9fa40e9 | 7 | private boolean closeToOthers(Point p, int size) {
int xmin = p.x - 1;
int xmax = p.x + size;
int ymin = p.y - 1;
int ymax = p.y + size;
if (xmin < 0) // In case the coordinates are negative
xmin = 0;
if (ymin < 0)
ymin = 0;
for (int i = xmin; i <= xmax; i++)
for (int j = ymin; j <= ymax; j++)
... |
da6e71cb-86cc-498f-ab48-90560513b38d | 2 | void fillRandom(double[][] map) {
for (int i = 0; i < map.length; i++) {
double[] row = map[i];
for (int j = 0; j < row.length; j++) {
map[i][j] = 1024*Math.random();
}
}
} |
6810de2b-7617-43e3-8db3-926bcceb034e | 9 | private final int jjStopStringLiteralDfa_0(int pos, long active0)
{
switch (pos)
{
case 0:
if ((active0 & 0x2e00L) != 0L)
{
jjmatchedKind = 15;
return 5;
}
return -1;
case 1:
if ((active0 & 0x2e00L) != 0L)
{
jjma... |
cd672c20-7cc3-41d5-8745-17fb3cd92bdd | 9 | @Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
Triangle other = (Triangle) obj;
if (i != other.i)
return false;
if (j != other.j)
return false;
if (k != other.k)
return false;
i... |
d4e220ad-0fdb-4254-8361-46d4f4f2e2fb | 2 | public void clearAll() {
for (ArrayList<Key> keyList : keys.values()) {
for (Key key : keyList) {
key.clear();
}
}
} |
f29d8239-a1f1-4c03-a67a-08724f98f8bc | 6 | @Override
public void mouseUp(MouseEvent e, int x, int y) {
Position p = GfxConstants.getPositionFromXY(x, y);
if (p.getRow() >= 0 && p.getRow() < GameConstants.WORLDSIZE
&& p.getColumn() >= 0
&& p.getColumn() < GameConstants.WORLDSIZE) {
// check if a tile was clicked
Unit u = game.getUnitAt(p);
... |
89580c35-d3e9-45ab-a2b4-bce595a776da | 1 | public static void addCreature(Creature cr)
{
if(cr.id > 0)
pool.add(cr.id, cr);
else
{
pool.add(cr);
cr.id = pool.indexOf(cr);
}
} |
9e97b155-364a-41d5-bef1-5d905dfff9fd | 6 | @Test
public void testGetWaitingQueues() throws Exception {
PreparedStatement ps = _connection.prepareStatement("INSERT INTO message (sender, receiver, queue) VALUES (1,2,3)");
for (int i = 0; i < 4; i++) { ps.execute(); }
ps = _connection.prepareStatement("INSERT INTO message (sender, recei... |
616ff9d7-3b41-47dd-b25d-388bf4088541 | 7 | public static void main(String[] args) throws IOException {
Path destination = Paths.get("src/main/java/com/dodosoft/dpm");
Files.list(SOURCE).forEach(chapterDir -> {
if (Files.isDirectory(chapterDir) == false) {
return;
}
final String chapterPackageN... |
029e95e1-6659-42f9-9ed0-a2521918c1ed | 6 | public void Update(GameTime gameTime)
{
if (lifeTimer == -1)
{
lifeTimer = gameTime.GetRuntime() + maxLife;
}
mPosition.PlusEquals(mVelocity.Times(new Vector2(1)));
mVelocity.DividedByEquals(new Vector2(1.05f));
sparkSizeFactor /= 1.05f;
float lifeDifference = lifeTimer - gameTime.GetRuntime();
... |
7acf039b-5f6f-45fe-a040-087c83364160 | 1 | public boolean ModificarPropiedad(Propiedad p){
if (p!=null) {
cx.Modificar(p);
return true;
}else {
return false;
}
} |
bfc0cc72-a0d1-4638-b3e0-3d7a294ebf7f | 7 | public int read(int width) throws IOException {
if (width == 0) {
return 0;
}
if (width < 0 || width > 32) {
throw new IOException("Bad read width.");
}
int result = 0;
while (width > 0) {
if (this.available == 0) {
this... |
62bdfb4e-d52e-40d4-b9e3-f072abc72409 | 0 | public static PermWriter getProject() {
return instance;
} |
207da254-c2bc-44bc-ad22-7a03016664ce | 2 | public boolean checkShapeDate(long fechaDesde, long fechaHasta){
return (fechaAlta >= fechaDesde && fechaAlta < fechaHasta && fechaBaja >= fechaHasta);
} |
71a690ce-5843-48c9-8c69-fa96fecd41e5 | 3 | public void paint(Graphics g) {
for (int y = 0; y < 7; y++) {
for (int x = 0; x < 7; x++) {
if (this.chrArray[y][x] == -16711936) {
g.setColor(Color.GREEN);
} else {
g.setColor(Color.LIGHT_GRAY);
}
g.fillRect((x * 50 + 10), (y * 50 + 30), 40, 40);
}
}
} |
c523eb70-baf6-472d-bcaa-05d7880acdda | 2 | public List<ValidateException> validateYear(int yearOfBirth) {
List<ValidateException> validateExceptionList = new LinkedList<>();
Calendar calendar = new GregorianCalendar();
calendar.setTime(new Date());
int currentYear = calendar.get(Calendar.YEAR);
if ((yearOfBirth < 1582) |... |
dac9bc43-6ad2-4192-853c-b99891a57ff5 | 3 | public void pickUpWeapon(Weapon w){
for(int i = 0; i<3 ; i++){
if(weapons[i] == activeWeapon){
if(w != null){
weapons[i] = w;
activeWeapon = w;
}else{
weapons[i] = WeaponFactory.createPlayerDefaultWeapon();
activeWeapon = weapons[i];
}
}
}
} |
58516eca-8677-4065-808f-708f5bde34da | 8 | public boolean fValidateTrackDetails(WebElement trackItem,String detail)
{
if(detail.equalsIgnoreCase("title")){
WebElement title = objCommon.getChildObject(trackItem, txtTrackTitle);
if(title==null) return false;
//get text
String txtDetail = title.getAttribute("text").trim();
//che... |
f3f58560-b7ee-4490-8ce1-f5c2a86dc4ce | 1 | private void checkPos() {
if ( pos == line.length() ) {
pos = -1;
}
} |
09fbcf5c-8912-4a40-b42b-af854a8a799e | 1 | public Shader() {
program = glCreateProgram();
uniforms = new HashMap<String, Integer>();
if (program == 0) {
System.err
.println("engine.graphics.Shader creation failed: Could not find valid memory location in constructor");
System.exit(1);
}... |
3dfa6f79-29ba-48dc-a2c3-b9b7d3eab26a | 3 | public BufferedImage getImage(){
if(!running){
return images.get(0);
}else{
long curTime = (System.currentTimeMillis() - startTime) % totalTime ;
for(int i=0; i<times.size(); i++){
if(curTime - times.get(i) <= 0){
return images.get(i);
}else{
curTime -= times.get(i);
}
}
}
ret... |
61d35f39-6ffc-45d6-b389-71e6ba99fdb9 | 9 | public boolean ramasserObjet(Objet o)
{
if(o instanceof Arme)
{
Arme a = (Arme) o;
if(a.getCategorieArme() == this.typeArme && a.getLevel() > this.arme.getLevel())
{
this.arme = a;
if(a.getLevel() == 1)
this.ptMana = this.ptManaMax = 120; // bâton de l'érudit
else
this.ptMana = this... |
909f12d3-b91a-4e87-99ca-f805318809d9 | 0 | protected int processHeader (byte[] header)
{
// TBD
// if (Outliner.DEBUG)
// System.out.println ("\tStan_Debug:\tPdbReaderWriter:processHeader"); }
return SUCCESS ;
} // end protected method processRecord |
4ef92d9f-a384-4106-9379-be4cb596dabd | 3 | private void createUser() {
String name = JOptionPane.showInputDialog("Name");
String cpr = JOptionPane.showInputDialog("CPR (ddmmyy-MRRG)");
JPasswordField nPass = new JPasswordField();
JPasswordField qPass = new JPasswordField();
JOptionPane.showConfirmDialog(null, nPass, "Enter password", 0);
JOpti... |
09a71694-57a2-48e0-8cde-3b8de9f58b09 | 0 | public String getHudsonBuildNumber()
{
return getManifestMainAttribute(
new Attributes.Name("Hudson-Build-Number"), "unknown"
);
} |
3215ace1-df8c-4745-83b0-55f55edd527d | 8 | private static double[][] calculateCovarianceMatrix(int userID, double[][] usersForUserMovies) {
double[][] covMatr = new double[UserMovieRatings.get(userID).size()][UserMovieRatings.get(userID).size()];
int movie1Index = 0;
for (Integer movie1ID : UserMovieRatings.get(userID).keySet()) {
int movie2Index = 0;
... |
5afa7af4-2c43-408f-a852-da6ef8697dab | 6 | public void testConstructor_int_int_int() throws Throwable {
TimeOfDay test = new TimeOfDay(10, 20, 30);
assertEquals(ISO_UTC, test.getChronology());
assertEquals(10, test.getHourOfDay());
assertEquals(20, test.getMinuteOfHour());
assertEquals(30, test.getSecondOfMinute());
... |
2ccb6e80-6e1a-4790-92ce-882c09db209d | 2 | public Object getComponent() throws Exception {
URLClassLoader loader = getClassLoader();
Class c = null;
if (classname == null) {
// return getGeneratedComponent(loader);
// classname = getGeneratedComponent(loader);
c = getGeneratedComponent(loader);
} else {
try {
c = loader.loadClass(getComp... |
ab664c6f-e5e8-4a11-b3a0-47a4e7ca4c88 | 8 | @Override
public Ptg calculatePtg( Ptg[] parsething )
{
Object o = null;
Formula f = ((Formula) getParentRec());
if( f.isSharedFormula() )
{
o = FormulaCalculator.calculateFormula( f.shared.instantiate( f ) );
}
else
{
Object r = null;
if( f.getInternalRecords().size() > 0 )
{
r = f.get... |
09d86a43-52e5-4521-bde3-d71bf22ce80d | 4 | private int getCurrentPage(String command, String pageParam) {
int currentPage = 0;
int page = 0;
if (pageParam != null) {
page = Integer.valueOf(pageParam).intValue();
}
if (command == null) {
currentPage = 1;
} else {
currentPage = page;
if (COMMAND_NEXT.equals(command)... |
ddaa0226-8d2e-4e74-a605-cd7136c7a9f5 | 6 | @Override
public Integer deleteNames(String... names) {
if (names == null || names.length == 0) {
throw new IllegalArgumentException("names must have at least one entry");
}
String query = "DELETE FROM `" + playerNamesTable + "` WHERE `name` ";
if (names.length == 1) {
... |
043b88b5-24e7-4339-bf1d-7ff9db09d525 | 4 | public Main() {
readConfig();
//下载文档
filedown = new FileDownload();
for(int i=0;i<HOSTSLIB.length;i++){
filedown.DownloadFile(HOSTSLIB[i], SAVEFILES[i]);
}
System.out.println("FileDownLoad OK");
//对下载的文档进行处理
updatetimecheck=new UpdateTimeCheck();
if(updatetimecheck.needUpdate()){
System.out.prin... |
74c23c15-f994-4bf8-94f4-ac3ea5a889cf | 0 | public int getWidth() {
return anim.getImage().getWidth(null);
} |
b287349e-a788-4c19-bddb-bcd089a3066d | 3 | public synchronized boolean setItem(FieldItem item, Position position) {
if (insideBounds(position) && this.getItemType(position) == ' ' && !isPositioned(item)) {
field[position.getX()][position.getY()] = item;
return true;
}
return false;
} |
855a4053-84a0-4b8e-8b5a-1f10830372ab | 9 | public void tokenize(String line) {
StringTokenizer tokenizer = new StringTokenizer(line);
while (tokenizer.hasMoreTokens()) {
String token = tokenizer.nextToken();
String[] metadata = token.split("/");
if (metadata.length > 2) {
String POS = null;
if (metadata[1].indexOf(":") > 0){
... |
6e84a418-ced5-424e-adea-c705555ae57e | 4 | private void drawCoordinates(java.awt.event.MouseEvent evt)
{
int length=graph_screen.getWidth();
int height=graph_screen.getHeight();
xmin=Double.parseDouble(Xmin.getText());
xmax=Double.parseDouble(Xmax.getText());
ymin=Double.parseDouble(Ymin.getText());
ymax=Doubl... |
e558ca43-ddf8-4b05-b1a1-1096662246ff | 5 | protected char[][] build_ct(String v_key,int pos)
{
int row=v_key.length();
char[][] result=new char[row][26];
for(int i=0;i<row;i++)
{
result[i][pos]=v_key.charAt(i);
}
for(int i=0;i<row;i++)
{
for(int j=1;j<26;j++)
{
int cur_pos=pos+j;
if(cur_pos>=26)
{
cur_pos-=26;
}
char c... |
784eac02-d407-48cd-977e-67fc75ff1e1c | 1 | public static int qdepth() {
int ret = 0;
for (Loader l = loader; l != null; l = l.next)
ret += l.queue.size();
return (ret);
} |
50b95754-50b3-4fe1-82ff-db2fccae4e31 | 1 | @Override
public void actionPerformed(ActionEvent e) {
if (getGraphics() != null)
paint(getGraphics());
} |
65a1e5c5-cfb1-4b33-918e-32f6e0a40263 | 1 | @Override
protected void generateFrameData(ResizingByteBuffer bb)
throws FileNotFoundException, IOException {
if(this.rawFrameContents!=null) {
bb.put(this.rawFrameContents);
}
} |
664b9d96-a77f-4e30-bff5-5034c533b522 | 7 | public static void main(String[] args) throws IOException {
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
String line = "";
StringBuilder out = new StringBuilder();
m = new int[10];
m2 = new int[10];
while ((line = in.readLine()) != null && line.length() != 0) {
if (line.trim(... |
4594e3de-a28b-4a06-b188-843f133869a7 | 6 | public boolean onItemUse(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, World par3World, int par4, int par5, int par6, int par7)
{
if (par3World.isRemote)
{
return true;
}
else
{
int var8 = par3World.getBlockId(par4, par5, par6);
p... |
e14dd259-475e-42e2-bd76-72e15c0cea8a | 2 | public void m4t1() {
synchronized (this) {
int i = 5;
while (i-- > 0) {
System.out.println(Thread.currentThread().getName() + " : " + i);
try {
Thread.sleep(500);
} catch (InterruptedException ie) {
}
... |
a4b252ae-0f41-4010-b09c-2cb03fb1841f | 4 | public static void changeDate(int rentTransID, String dateIn, String dateOut) {
try {
if(conn == null || conn.isClosed()){
conn = DatabaseConnection.getConnection();
}
} catch (SQLException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
try{
conn.setA... |
b5d6c5cd-c7b8-44da-b07a-cb254489795f | 2 | public double removeCharge(double request) {
if (request <= 0.0)
return 0.0;
if (charge >= request) {
charge -= request;
lastTickDraw += request;
return request;
}
double ret = charge;
charge = 0.... |
96fef355-7e42-445c-bae3-2309a74e7d8b | 4 | @Override
public PlayerLeftMessage LeaveServer(int playerID) {
Player player = _state.TryGetPlayer(playerID);
if (player == null)
return MessageCreator.CreatePlayerLeftMessage(new LinkedList<>(), null, null, null);
List<Integer> idsToUpdate = new LinkedList<>(_state.Lobby.GetPl... |
0ee4552b-f77f-494a-a2d1-b1199398de69 | 7 | public static int[] getLCP(char s[], int[] sufAr){
int n = s.length, i, j, l = 0;
int invSufAr[] = new int[n];
for(i=0; i<n; ++i) invSufAr[sufAr[i]] = i;
int lcp[] = new int[n];
for(i=0; i<n; ++i){
j = invSufAr[i];
if(j>0) while(sufAr[j]+l<n && sufAr[j-1]+... |
78f4a402-2baf-4166-b37e-3a5e267698bc | 9 | protected void processNodeOutgoing(TreeNode node)
{
mxIGraphModel model = graph.getModel();
TreeNode child = node.child;
Object parentCell = node.cell;
int childCount = 0;
List<WeightedCellSorter> sortedCells = new ArrayList<WeightedCellSorter>();
while (child != null)
{
childCount++;
double so... |
e4b8ffac-8fe4-487d-ad76-6ac9e2d52f34 | 2 | public static boolean isPublicStaticFinal(Field field) {
int modifiers = field.getModifiers();
return (Modifier.isPublic(modifiers) && Modifier.isStatic(modifiers) && Modifier
.isFinal(modifiers));
} |
f1904eb6-ae70-421c-91f5-0fc4b2e052ab | 3 | public String toString(){
StringBuffer result = new StringBuffer();
for(Map.Entry<String, Integer> e : addressMap.entrySet()){
result.append(e.getKey());
result.append(" : ");
result.append(e.getValue());
result.append("\n");
}
result.append("\n");
for(Map.Entry<String, Descriptor> e : descript... |
c4cdd1cf-a651-4d42-ab5d-c51844c9808b | 5 | public Sound(String fileName) {
// specify the sound to play
// (assuming the sound can be played by the audio system)
// from a wave File
try {
File file = new File(fileName);
if (file.exists()) {
AudioInputStream sound = AudioSystem.getAudioInputStream(file);
// load the sound into... |
3a41562d-07e0-4c72-bf0d-74efd9ae5795 | 8 | public static void main( String [ ] args )
{
QuadraticProbingHashTable<String> H = new QuadraticProbingHashTable<>( );
long startTime = System.currentTimeMillis( );
final int NUMS = 2000000;
final int GAP = 37;
System.out.println( "Checking... (no more output means success)" )... |
ea8444f8-362a-4943-9263-191c7da29fa8 | 9 | private int clearExecList(int totalPE)
{
int removeSoFar = 0; // number of PEs removed so far
ResGridlet obj = null;
// first, remove unreserved Gridlets
int i = 0;
while ( i < gridletInExecList_.size() )
{
obj = (ResGridlet) gridletInExecList_.get(i);
... |
a1359354-88ac-4f43-9ab5-9a73a006815d | 5 | private ModuleLoader() {
super(null);
final String className = this.getClass().getCanonicalName()
.replace('.', '/')
+ ".class";
final URL url = Main.class.getClassLoader().getResource(className);
if (url.getProtocol().equals("file")) {
final Path classPath = Path.getPath(url);
this.jar = false;
... |
40b3de7a-2984-48de-bfe3-9a39f70873b1 | 5 | public Enumeration<Node> getSortedNodeEnumeration(boolean backToFront){
if(!Configuration.draw3DGraphNodesInProperOrder) {
return flatList.elements();
}
PositionTransformation t3d = Main.getRuntime().getTransformator();
int actualVersionNumber = t3d.getVersionNumber();
if((lastVersionNumber != actualVersio... |
973a1031-d2cc-4a63-8b76-9ad945e9d911 | 8 | public List<? extends Object> loadRelated (Class type, Object... relationAndRelated) {
Transaction transaction = _manager.currentTransaction ();
StringBuilder criteria = new StringBuilder ("");
List<? extends Object> results;
Query query;
String relation;
Object related;
... |
413c11d8-f435-404f-a4cd-da70f5fd0cb4 | 2 | String getRawURI(URL url) {
String uri = url.getPath();
if (url.getQuery() != null && url.getQuery().length() != 0) {
uri += "?" + url.getQuery();
}
return uri;
} |
55924c45-0446-40ef-95ac-35a2b0a33cf4 | 8 | BulkScorer optionalBulkScorer(LeafReaderContext context) throws IOException {
List<BulkScorer> optional = new ArrayList<BulkScorer>();
Iterator<BooleanClause> cIter = query.iterator();
for (Weight w : weights) {
BooleanClause c = cIter.next();
if (c.getOccur() != Occur.SHOULD) {
contin... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.