method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
bb55d94a-4601-40d6-87f1-acda398dacaf | 2 | public String getInterfaceMethodrefName(int index) {
InterfaceMethodrefInfo minfo
= (InterfaceMethodrefInfo)getItem(index);
if (minfo == null)
return null;
else {
NameAndTypeInfo n
= (NameAndTypeInfo)getItem(minfo.nameAndTypeIndex);
... |
85e95709-a9f3-4379-9edd-73cddf777ec9 | 8 | public Tile returnBestCityScoresMod(int settlerR, int settlerC, int capitalR, int capitalC, double distBias, int maxDist)
{
evalBefore();
int[][] cityScores = new int[rows][cols];
for (int r = 0; r < rows; r++)
{
for (int c = 0; c < cols; c++)
{
int dist = (int)Math.sqrt(Math.pow(r-settlerR,2) + Math... |
3b9728c8-c02f-4d4f-b230-10545abcd53f | 9 | private void verifierAuthentification()
{
if (loginTF.getText().equals("") && pwdTF.getText().equals(""))
errorMessageLabel.setText("Les champs login et password sont vides.");
else if (loginTF.getText().equals(""))
errorMessageLabel.setText("Le champs login est vide.");
... |
74d5ae4d-a569-4922-9331-12ced6e1f6bd | 8 | private static void preRenderChunk(
short[][] sectionBlockIds, byte[][] sectionBlockData,
boolean[] usedSections, byte[] biomeIds, BlockMap blockMap,
BiomeMap biomes, int cx, int cz, int[] colors, short[] heights) {
/**
* Color of 16 air blocks stacked
*/
fina... |
56b00422-e896-4d48-831d-5c3960fb5657 | 5 | public synchronized static Logger getLogger() {
if(logger == null) {
try {
logger = Logger.getLogger("RedpinLogger");
FileHandler fh = new FileHandler(Configuration.LogFile);
if(Configuration.LogFormat == LoggerFormat.PLAIN) {
fh.setFormatter(new SimpleFormatter());
} else if(Configura... |
c002c560-d48c-4dd1-8b4b-df7b74ad55ad | 0 | public String getType() {
return type;
} |
fd6750a7-68ab-418b-be70-ae35a2be87a4 | 5 | static final int method1908(int i, int i_1_, int i_2_, boolean bool,
int i_3_, int i_4_, int i_5_) {
i_2_ &= 0x3;
anInt3216++;
if (bool != true)
aClass21_3217 = null;
if ((i_5_ & 0x1 ^ 0xffffffff) == -2) {
int i_6_ = i_4_;
i_4_ = i_3_;
i_3_ = i_6_;
}
if ((i_2_ ^ 0xffffffff) == -1)
ret... |
9777122f-a24d-4c53-81b4-1acf2e92b1d6 | 6 | public synchronized boolean removeIRCEventListener(IRCEventListener l) {
if (l == null)
return false;
int index = -1;
for (int i = 0; i < listeners.length; i++)
if (listeners[i].equals(l)) {
index = i;
break;
}
if (index... |
2c7b774d-7230-4f92-ad4f-b19c3f224f92 | 4 | private Vector2 adjust(float minx, float maxx, float miny, float maxy, Vector2 v){
if(v.x > maxx - viewportWidth * zoom / 2) v.x = maxx - viewportWidth * zoom / 2;
if(v.x < minx + viewportWidth * zoom / 2) v.x = minx + viewportWidth * zoom / 2;
if(v.y > maxy - viewportHeight * zoom / 2) v.y = maxy - viewportHeigh... |
137b5924-6e85-4e1f-bdba-25815abbe62a | 5 | private static void write(Path path) throws IOException, InterruptedException {
int value;
int width;
int height;
byte rgba[] = new byte[4];
int bitmap[];
PixelGrabber pg;
BufferedImage img = null;
try {
img = ImageIO.read(image.toFile());
... |
903a4857-7d11-41c7-977c-480a1e605e8e | 4 | public int[] sensedCell(int[] pos, int dir, Sense.senseDir sD) {
int[] sensedCellPos = new int[2];
switch (sD) {
case HERE:
sensedCellPos = pos;
break;
case AHEAD:
sensedCellPos = adjacentCell(dir);
break;
... |
c1545730-16b7-43ab-858d-3f9cc6e18472 | 3 | public void tick() {
time++;
if (time >= lifeTime) {
remove();
return;
}
xx += xa;
yy += ya;
zz += za;
if (zz < 0) {
zz = 0;
za *= -0.5;
xa *= 0.6;
ya *= 0.6;
}
za -= 0.15;
int ox = x;
int oy = y;
int nx = (int) xx;
int ny = (int) yy;
int expectedx = nx - x;
int expectedy... |
f9ad22b5-4fd8-472f-86fa-d589f787d8ce | 7 | public int[] merge(int[] L1, int[] L2) {
int[] L = new int[L1.length + L2.length];
int i = 0;
while ((L1.length != 0) && (L2.length != 0)) {
if (L1[0] < L2[0]) {
L[i++] = L1[0];
L1 = eliminar(L1);
if (L1.length == 0) {
while (L2.length != 0) {
L[i++] = L2[0];
L2 = eliminar(L2);
... |
1b51257f-2b09-47b2-81ff-3b54ab8aafad | 1 | public Car build() {
if (builtOn != null) {
throw new IllegalStateException("can't call build more than once");
}
builtOn = new Date();
delegate.setBuiltOn(builtOn);
return delegate;
} |
5d8fe2b0-e2a3-4828-90ca-72d02ecf0cb5 | 4 | * @return Returns whether the given column in the line with the given
* index lies within a tab character.
*/
public boolean column_in_tab(int line, int col) {
int ind = 0;
StringBuilder l = code.getsb(line);
int i;
for (i = 0; i < col && ind < l.length(); ind++) {
if (l.charAt(ind... |
eedb917b-1820-4ef6-80ef-86da05c124b2 | 3 | *@param nivel
* @return des
**/
public long cobrarMiembros(beansMiembro miembro, int nivel){
long a = 0, desc = 0, des = 0;
if(nivel <= 10){
if(condicionarPago(miembro.getListaInterna(), nivel) == true){
for(beansMiembro miembroInterno : miembro.getListaInterna()){
desc += devolverPorcentaje(miembroI... |
10bcf01c-992e-4b1b-a48b-da341ae90dac | 6 | @Override
public void caseADeclLeiaDefinicaoComando(ADeclLeiaDefinicaoComando node)
{
inADeclLeiaDefinicaoComando(node);
if(node.getLeia() != null)
{
node.getLeia().apply(this);
}
if(node.getLPar() != null)
{
node.getLPar().apply(this);
... |
20168b4e-55a0-40c4-9b44-8deb025a8bea | 5 | public void applyMove(Operators2048 op) {
boolean moved = false;
switch (op) {
case UP:
moved = moveUp();
break;
case DOWN:
moved = moveDown();
break;
case RIGHT:
moved = moveRight();
break;
case LEFT:
moved = moveLeft();
break;
}
if (moved) {
addTile();
}
} |
4283458c-805c-4890-9d04-a4497e8afacc | 9 | @Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
AtLine atLine = (AtLine) o;
if (clazz != null ? !clazz.equals(atLine.clazz) : atLine.clazz != null) return false;
if (method != null ? !method.equals(atLine.method) : atLine.me... |
eff71b0a-e00e-42a3-8ad2-0491c88dacc4 | 5 | @SuppressWarnings("unchecked")
public void load(String courseraUrl) throws IOException {
// Coursera has a limit of 1000 courses per query, but over 1500
// classes at the time of this writing. We will use categories as
// additional argument to split the whole thing into multiple requests.
universities.clear(... |
0a1178d2-e2b5-43e3-98b8-8ad7de6cf53c | 2 | public static ArrayList<TestReaction> findTestReactionByTestId(ArrayList<TestReaction> testReactions, int id) {
ArrayList<TestReaction> outputReactions = new ArrayList<TestReaction>();
for(TestReaction tr:testReactions) {
if(tr.test==id) {
outputReactions.add(tr);
}
}
return outputReactions;
} |
2d5e28c3-3012-4273-a29c-a875905e04fa | 7 | private void writeOriginsQuartiles(String originsQuartilesFilename,
Map<Byte, SpikeClassStats> stats, SpikeClassStats single33,
SpikeClassStats single66, SpikeClassStats single100, byte maxHop)
throws IOException {
// create folders if needed
if (originsQuartilesFilename.lastIndexOf("/") != -1) {
File ... |
81a1650e-9a09-4112-9b12-59942000bf89 | 8 | public Image scale(Image img)
{
// Offset the image by one pixel so there's a border around it.
// This lets us avoid having to check that A-I are in range of the image before samping them
sourceGraphics.drawImage(img, 1, 1, null);
int line = width + 2;
for (int y = 0; y < height; y++)
{
// Two lines o... |
954fecab-9d0d-4d7c-8934-d548107be0d6 | 9 | public static Command inputEventToCommand(InputEvent e) {
if (e==null) {return NO_COMMAND;}
if (e instanceof KeyEvent) {
switch (((KeyEvent)e).getKeyChar()) {
case 'w': return MOVE_UP;
case 'a': return MOVE_LEFT;
case 's': return MOVE_DOWN;
case 'd': return MOVE_RIGHT;
case '=': return D... |
e2f84145-de9c-495b-a4e0-3657fe1223fb | 5 | public void extract(LauncherAPI api, int min, int max)
{
System.out.println("Extracting '" + getFileName() + "'...");
if (type == Type.NATIVE || type == Type.ADDITIONNAL)
{
File dest = this.dest;
boolean recursive = true;
... |
e607e903-b9b6-4244-88d8-7b8399996a49 | 7 | static String toHex4ByteString(int i) {
String hex = Integer.toHexString(i);
if (hex.length() == 1)
return "0000000" + hex;
if (hex.length() == 2)
return "000000" + hex;
if (hex.length() == 3)
return "00000" + hex;
if (hex.length() == 4)
return "0000" + hex;
if (hex.length() == 5)
return "000... |
5e7087c5-5c58-427e-8354-efb2de571c9b | 1 | private String parseSettingsPath(String settingsPath) {
if (settingsPath.matches("^~.*")) {
settingsPath = settingsPath.replace("~", "");
String home = System.getProperty("user.home");
settingsPath = home + settingsPath;
}
return settingsPath;
} |
0154a575-897f-4663-a2ca-ef9c6481bec6 | 4 | public void calculateCycleLength(){
boolean notFound = true;
int currentState;
int threshhold = 10;
while(notFound){
for(int i=0;i<threshhold;i++){
update();
}
currentState = getState();
for(int i=0;i<threshhold;i++){
update... |
330cc258-ad08-4d28-b3e5-9e85689923fd | 9 | public boolean renderBlockFenceGate(BlockFenceGate par1BlockFenceGate, int par2, int par3, int par4)
{
boolean flag = true;
int i = blockAccess.getBlockMetadata(par2, par3, par4);
boolean flag1 = BlockFenceGate.isFenceGateOpen(i);
int j = BlockDirectional.getDirection(i);
if... |
fbdfccf5-2f7c-4f47-b487-83ab839a9efa | 5 | public boolean existeRelacion( String nombreClaseA, String nombreClaseB, int tipoRelacion ){
for ( int i=0 ; i<listaFigura.size() ; i++ ) {
if ( listaFigura.get(i) instanceof RelacionGrafica ){
RelacionGrafica r = (RelacionGrafica)listaFigura.get(i);
... |
f8af59a1-3dfe-4b7c-a157-5696f3906649 | 3 | public void visitLdcInsn(final Object cst) {
buf.setLength(0);
buf.append(tab2).append("LDC ");
if (cst instanceof String) {
appendString(buf, (String) cst);
} else if (cst instanceof Type) {
buf.append(((Type) cst).getDescriptor()).append(".class");
} else {
buf.append(cst);
}
buf.append('\n');
... |
b92bc23b-aeb1-40f1-9592-b2e534d4f6fd | 7 | boolean isDynamicTypePersistenceModeDifferent(SystemObjectTypeProperties property, DynamicObjectType.PersistenceMode persistenceMode) {
// Liste der erweiterten Typen (SuperTypen)
final List<SystemObjectType> superTypes = new ArrayList<SystemObjectType>();
superTypes.addAll(createSuperTypes(property.getExtendedPi... |
9dd82d2f-45cc-45d4-8c1a-5a02425cf2d8 | 8 | public boolean similar(Object other) {
if (!(other instanceof JSONArray)) {
return false;
}
int len = this.length();
if (len != ((JSONArray)other).length()) {
return false;
}
for (int i = 0; i < len; i += 1) {
Object valueThis = this.ge... |
3626701e-4741-447b-b524-2b646aa17bfa | 3 | static String getFingerPrint(HASH hash, byte[] data){
try{
hash.init();
hash.update(data, 0, data.length);
byte[] foo=hash.digest();
StringBuffer sb=new StringBuffer();
int bar;
for(int i=0; i<foo.length;i++){
bar=foo[i]&0xff;
sb.append(chars[(bar>>>4)&0xf]);
... |
3da4dfb2-09c5-4163-bfb3-1cee4ee61a08 | 5 | public final void method43(AbstractToolkit var_ha, int i) {
if (i != -14218)
aBoolean10019 = false;
anInt10016++;
Object object = null;
r var_r;
if (aR10036 == null && aBoolean10003) {
Class2 class2 = method2417(i + 14218, var_ha, 262144, true);
var_r = class2 != null ? ((Class2) class2).aR118 : nul... |
4b554903-8959-49ed-904d-3582eef34120 | 3 | public Move chooseMove(State s) {
// remember who we are so we can correctly evaluate states
me = s.whoseTurn();
// The rest of this function looks a lot like evalMove, except
// that it doesn't just track the minimaxvalue, but also the
// best move itself.
// get a list of possible moves
MyList moves = s.find... |
4ac30848-f8aa-4abd-9983-1dea0113fa57 | 7 | @Override
public Column parse() {
if(!this.prepared) {
this.prepared = true;
StringBuilder sB = new StringBuilder();
sB.append(this.name);
String type = this.t.getTextual();
if(this.t == DataType.RAW) {
sB.append(type.replace("%1", this.data));
}else if(null != this.length) {
... |
c07522b9-125c-45a5-8088-14ab3a3964cd | 4 | @SuppressWarnings("deprecation")
@EventHandler
public void onTeamChatKick(PlayerKickEvent event){
if(functions.isPlayerInTC(event.getPlayer())){
if(config.getBoolean("tc.general.kick-offline-players")){
TeamChat2.remove(event.getPlayer().getName());
for(Player p : Bukkit.getServer().getOnlinePlayers()){... |
450a7842-a759-49b7-8920-1ba9ce0263e5 | 5 | void searchFiu(String ID)
{
//read text file
String line = "";
//traverses the whole file line by line
try
{
BufferedReader reader = new BufferedReader(
new FileReader("FiuDB.txt"));
while((line = reader.read... |
93c42c16-30db-4603-9393-31e5b174d776 | 4 | private void displayCompResults(List<SplitMapperCompJvmCost> cMapperJvmCostList, List<SplitReducerCompJvmCost> cReducerJvmCostList,
String mapperFile, String reducerFile, String jobName) throws IOException {
File mFile = new File(mapperFile);
File rFile = new File(reducerFile);
if(!mFile.getParentFile().ex... |
4d4e74af-d745-4102-9960-cb194355ec3a | 8 | @Override
public void executeMsg(Environmental host, CMMsg msg)
{
if(affected instanceof MOB)
{
final MOB M = (MOB)affected;
if((msg.target()==M)
&&((msg.targetMinor()==CMMsg.TYP_LOOK)||(msg.targetMinor()==CMMsg.TYP_EXAMINE))
&&(CMLib.flags().canBeSeenBy(M,msg.source())))
{
final String s=CMLib... |
f8d9cda6-17e1-47af-92f2-5cd96c479fc4 | 2 | @Override
public void keyPressed(KeyEvent e) {
// TODO Auto-generated method stub
if(e.getKeyCode() == KeyEvent.VK_ENTER) {
String message = txtBox.getText();
String showMessageForMe = "me: " + message + "\n";
message = message.replace("<", "<");
message = message.replace(">", ">");
String me... |
148de5e0-b6cc-4676-a439-801798d87b2c | 1 | @RequestMapping(value = "/saveProject", method = RequestMethod.POST)
public String saveProject(@ModelAttribute("project") Project project, BindingResult result) {
System.out.println("project id:" + project.getProjectId() + "name" + project.getName());
if (project.getProjectId() == null) {
... |
0d282c35-2eb1-47d8-b571-12f06bd0fce6 | 3 | public Socket findServer(){
String IP = getIP();
String[] nodes = IP.split ("\\D");
String newIP = "";
for (int i = 0 ; i < nodes.length - 1 ; i++)
{
newIP = newIP.concat (nodes [i] + ".");
}
//Declares an array used for searching for a server
Socket[] sktarr = new Soc... |
5dd70152-9591-4134-b1af-77bf0f62382a | 0 | public int getSourceLinesSize() {
return sourceLines.size();
} |
c4c6f983-0e41-464b-b060-a62529775fea | 2 | public void interact(ThePlayer p)
{
for (Item k : getKeys(p))
{
Key K = (Key) k;
if (K.getName().equals(keyName))
{
System.out.println("Thou use-ith thine key to open ye door.");
p.moveTo(getLocation());
return;
... |
15d7cecd-cdbe-44f6-9953-28f7f1ac48fc | 3 | protected static boolean getBoolean(String key, JSONObject json) throws JSONException {
String str = json.getString(key);
if(null == str || "".equals(str)||"null".equals(str)){
return false;
}
return Boolean.valueOf(str);
} |
1d9f648a-1c75-43a6-951c-3e1e83c83e50 | 4 | private void init() {
Scanner reader = null;
try {
reader = new Scanner(new File(Constants.IMAGE_LIST_PATH));
} catch (FileNotFoundException e) {
e.printStackTrace();
}
while(reader.hasNext()){
String row = reader.nextLine();
if(row.isEmpty()) { //Ignore empty rows.
continue;
}
Strin... |
82859210-d0df-463f-abf2-73d942c961c0 | 5 | public static void act(Unit unit) {
MapPoint goTo = null;
MapPoint unitPlace = getNearestInfantryPreferablyOutsideBunker(unit);
if (unitPlace != null) {
goTo = unitPlace;
}
// If there's someone to protect, go there
if (goTo != null) {
double distance = goTo.distanceTo(unit);
// If distance is bi... |
2b0dd51f-f7ed-4d7a-8f40-5b14b1b2ad37 | 5 | @Override
public boolean equals(Object o) {
if(this == o) return true;
if(o == null) return false;
if(getClass() == o.getClass()) {
Controlsystem s = (Controlsystem) o;
return (inQueue.equals(s.inQueue) &&
outQueue.equals(s.outQueue) &&
... |
db3626b0-931e-4311-92a2-964025d67db7 | 9 | public void HuffmanBlockEncoder(BufferedOutputStream outStream, int zigzag[], int prec, int DCcode, int ACcode)
{
int temp, temp2, nbits, k, r, i;
NumOfDCTables = 2;
NumOfACTables = 2;
// The DC portion
temp = temp2 = zigzag[0] - prec;
if(temp < 0) {
temp = -temp;
temp2--;
}
nbits = 0;
while... |
da90f130-ac4e-4bd8-bfae-979305a51334 | 7 | protected void wrapBuffer()
throws IOException
{
// Handle chunking
int size=size();
if (_chunking && size()>0)
{
prewrite(__CRLF,0,__CRLF.length);
while (size>0)
{
int d=size%16;
if (d<=9)
... |
cbc7b5b0-834a-4827-9723-6057bd8b38f5 | 4 | public boolean daysAreChecked() {
return (chckbxLun.isSelected() || chckbxMar.isSelected()
|| chckbxMie.isSelected() || chckbxJue.isSelected() || chckbxVie
.isSelected());
} |
a2fca8e2-1486-4a18-87c0-6209bf746b46 | 8 | @Override
public void run() {
try (DatagramSocket socket = new DatagramSocket(Constants.SYSTEM_PORT)) {
byte[] buf = new byte[512];
DatagramPacket packet = new DatagramPacket(buf, buf.length);
// infinite listening
for (;;) {
socket.receive(... |
b5718fa5-af9c-44ba-8c25-2660ae2051ec | 2 | public User findUserByLogin(String login){
User user = new User();
String requete = "select * from User where Login=?";
try {
PreparedStatement ps = MyConnection.getInstance().prepareStatement(requete);
ps.setString(1, login);
ResultSet resultat = ps.executeQuery();
... |
320b4cd3-7e5d-4314-b46c-3fe3a233a993 | 5 | @Test
public void testInfixToPostfix1() throws DAIllegalArgumentException,
DAIndexOutOfBoundsException, ShouldNotBeHereException,
BadNextValueException, UnmatchingParenthesisException {
try {
QueueInterface<String> postFix = calc.infixToPostfix(infix);
String result = "24+";
assertEquals(result, calc... |
481a2c5a-a412-4051-8dde-2556c4b0ad7b | 7 | static int CacheCorrespondenciaDirecta(int i) {
int Etiqueta = Integer.parseInt(Integer.toBinaryString(0x1000 | i).substring(1).substring(0, 3));
int Palabra = Integer.parseInt(Integer.toBinaryString(0x1000 | i).substring(1).substring(9, 12), 2);
int Linea = Integer.parseInt(Integer.toBinaryStr... |
bd8d8f8d-d3f4-4bdd-b39b-a90f7a214d52 | 5 | private void networkStartup()
{
String load = "n";
while (!(load.equals("y") || load.equals("n")))
{
System.out.print(" Load network (y/n) : ");
try
{
load = bufReader.readLine();
load = load.toLowerCase();
}
... |
4357474c-893b-4fc7-825a-37ba1938741d | 8 | @Override
public void actionPerformed(ActionEvent e)
{
Reference.lastActionMinute = new DateTime().getMinuteOfDay();
if (e.getSource() == overviewButton)
{
Reference.overPanel = new OverPanel();
... |
bf7a5e45-50ad-4eb2-a3a2-359db84310bb | 6 | private static int hexToInt(char ch) {
if ('a' <= ch && ch <= 'f') { return ch - 'a' + 10; }
if ('A' <= ch && ch <= 'F') { return ch - 'A' + 10; }
if ('0' <= ch && ch <= '9') { return ch - '0'; }
throw new IllegalArgumentException(String.valueOf(ch));
} |
f878699f-5cce-4121-ac2e-4ac89b8ca9c2 | 4 | public void setSuperstrateRefractiveIndex(double index){
if(this.calcEffectiveDone)this.clearData();
this.superstrateRI = index;
super.superstrateRefractiveIndex = index;
this.setSuperstrateRI = true;
if(this.setMeasurementsGrating && this.setGratingPitch && super.setWavelength)t... |
a0af1250-f638-4aaa-bc67-0b9fdd55755e | 0 | public UpdateChecker() {
} |
bff8e9bc-2cd1-447c-a9d2-e3ab555cff4b | 7 | @Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
BigFraction that = (BigFraction) o;
if (denominator != null ? !denominator.equals(that.denominator) : that.denominator != null) return false;
i... |
981b7500-f604-48ab-bc1e-ea73132d2a34 | 2 | private static void parseStyles(Map<String, String> styles, String inlinedStyles) {
String[] keyValues = inlinedStyles.split(",");
for (String keyValue : keyValues) {
String[] kv = keyValue.split(":");
if (kv.length > 1) {
styles.put(kv[0].trim(), kv[1].trim());
... |
b2c275dd-67a2-4b53-9acc-2e25eb9509e4 | 3 | public ArrayList<MatchScheduling> schedule(ArrayList<Team> teams) throws SQLException
{
ArrayList<MatchScheduling> matches = new ArrayList();
int i = 1;
while (getGroup(i, teams) != null)
{
ArrayList<Team> group = getGroup(i, teams);
ArrayList<Team> group2 =... |
ac93e880-ca54-4142-a80b-65ecdea0b72f | 1 | public static void print(ListNode root){
ListNode step = root;
while(step != null){
System.out.print( +step.val);
step = step.next;
}
System.out.println();
} |
53743bfa-e7b9-463f-8db0-adc48c3189d3 | 9 | Page readPageData(RandomAccessFile raf) throws IOException {
PageId pid;
Page newPage = null;
String pageClassName = raf.readUTF();
String idClassName = raf.readUTF();
try {
Class<?> idClass = Class.forName(idClassName);
Class<?> pageClass = Class.forNam... |
e320a82b-25af-499f-8931-0fac5199d891 | 7 | public boolean scrollTo(int line, int offset)
{
// visibleLines == 0 before the component is realized
// we can't do any proper scrolling then, so we have
// this hack...
if(visibleLines == 0)
{
setFirstLine(Math.max(0,line - electricScroll));
return true;
}
int newFirstLine = firstLine;
int new... |
a8c80a51-b1ef-4402-ab2a-e123833c2722 | 6 | @Override
public Object getValueAt(int rowIndex, int columnIndex) {
ArrayList<Event> eventsPerHall = schedulesMap.get(columnNames[columnIndex]);
if (eventsPerHall != null) {
for (int i = 0; i <= this.daysInMonth; i++) {
if(rowIndex == i){
for (Event event : eventsPerHall) {
Date eventStartDate = ... |
4f2b5a8e-6458-4713-ba44-0f4bcf2929d8 | 9 | public String nextToken() throws JSONException {
char c;
char q;
StringBuilder sb = new StringBuilder();
do {
c = next();
} while (Character.isWhitespace(c));
if (c == '"' || c == '\'') {
q = c;
for (; ; ) {
c = next();
... |
f9613e1b-4469-4702-b3e8-90cfc067c33e | 5 | public static Double calculate(Component c1, Component oper, Component c2, MathGame game) {
NumberCard card1 = null;
NumberCard card2 = null;
OperationCard operation = null;
try {
card1 = (NumberCard) c1;
card2 = (NumberCard) c2;
operation = (OperationCard) oper;
} catch(Exception e) {
System.out.... |
98b2f15c-0a2e-4985-8685-2304abe4519a | 3 | public void listen()
{
try
{
while (!this.open)
{
Thread.sleep(SLEEPTIME);
}
while (this.open)
{
String text = this.client.receive().toString();
enteredText.insert(text + "\n", enteredText.getText().length());
enteredText.setCaretPosition(entered... |
eda62854-f483-4613-991a-64e80ca695bf | 6 | public synchronized void drop (DropTargetDropEvent dropTargetDropEvent)
{
try
{
Transferable tr = dropTargetDropEvent.getTransferable();
if (tr.isDataFlavorSupported (DataFlavor.javaFileListFlavor)) {
dropTargetDropEvent.acceptDrop (DnD... |
51a278e1-d388-4c56-ba78-83fb64899365 | 7 | public final void method78(int i, boolean bool, Component component,
int i_11_) throws Exception {
if (anInt5158 == 0) {
if (i < 8000 || (i ^ 0xffffffff) < -48001)
throw new IllegalArgumentException();
anInt5157 = !bool ? 1 : 2;
if (i_11_ != 27929)
aDirectSound5162 = null;
anInt5161 =... |
376ea822-24bf-4483-bd50-17c49bd7b04c | 9 | public boolean hasEmbeddedMovie() {
if (isEmpty() || getTapePointer() <= 0)
return false;
if (numberOfAtoms > 0) {
if (atom[0].rQ == null || atom[0].rQ.isEmpty())
return false;
}
if (obstacles != null && !obstacles.isEmpty()) {
RectangularObstacle o = obstacles.get(0);
if (o.rxryQ == null || o.r... |
a49a2d8e-1edf-49d7-acc7-415f72af44cf | 2 | public PublishedSwarmDetails getSwarmDetails( final long swarmid ) {
return (new SQLStatementProcessor<PublishedSwarmDetails>( "SELECT * FROM swarm_extras WHERE swarmid = ?" ){
PublishedSwarmDetails process(PreparedStatement s) throws SQLException {
s.setLong(1, swarmid);
ResultSet rs = s.executeQuery();
... |
17f4ee20-3279-49d0-8cef-287af91eac12 | 7 | private static void getSongLibrary(ArrayList<Song> songs, ArrayList<String> dates, ArrayList<String> names, ArrayList<String> artists)
{
TimeCalculator calc= new TimeCalculator();
for(int i=(names.size()-1); i>=0; i--){
boolean contains=false;
for(Song song: songs){
if (song.getTitle().toLowerCase()
... |
f4a778a8-3e46-4301-9e61-a38db8abb802 | 3 | public static Bank narrow (org.omg.CORBA.Object obj)
{
if (obj == null)
return null;
else if (obj instanceof Bank)
return (Bank)obj;
else if (!obj._is_a (id ()))
throw new org.omg.CORBA.BAD_PARAM ();
else
{
org.omg.CORBA.portable.Delegate delegate = ((org.omg.CORBA.portable... |
3daa3465-1a7c-44bf-8c3d-eccacf68329b | 4 | private short try_open_comport()
{
// the next line is for Raspberry Pi and gets us into the while loop and was suggested here was suggested http://www.raspberrypi.org/phpBB3/viewtopic.php?f=81&t=32186
System.setProperty("gnu.io.rxtx.SerialPorts", COM_PORT_NAME);
Enumeration portEnum = CommPortIdentifier... |
16ccb425-c235-41a9-98be-8488d458a0f3 | 3 | boolean alreadyInFile(String name) {
File file = new File("Users.txt");
Scanner scanner;
try {
scanner = new Scanner(file);
while (scanner.hasNextLine()) {
String lineFromFile = scanner.nextLine();
if(lineFromFile.contains(name)) {
JOptionPane.showMessageDialog(null, "Username has already ... |
84bd03d8-73ad-4d47-8bfb-858fd7d25330 | 4 | public boolean accept(File f) {
if (f != null) {
if (f.isDirectory()) {
return true;
}
String extension = getExtension(f);
if (extension != null && filters.get(getExtension(f)) != null) {
return true;
};
}
... |
eed37658-0838-484d-a888-8e34d5953226 | 0 | public Encoder correspondingEncoder() {
// return this;
return xmlcodec;
} |
0325cfa7-ba46-42d1-b08b-fad57c3cd13d | 6 | public static void main(String[] args) {
// TODO Auto-generated method stub
Scanner scan = new Scanner(System.in);
int a, b, c, max;
System.out.print("整数aを入力 >");
a = scan.nextInt();
System.out.print("整数bを入力 >");
b = scan.nextInt();
System.out.print("整数cを入力 >");
c = scan.nextInt();
if(a > b &&... |
03fd7a52-d018-4e33-a701-eef56e7c2af4 | 4 | private Direction getDirection()
{
if (id.length() == 1) return Direction.None;
else if (id.substring(id.length()-1).equals("0")) return Direction.NW;
else if (id.substring(id.length()-1).equals("1")) return Direction.NE;
else if (id.substring(id.length()-1).equals("2")) ... |
3a590356-7f7d-4b28-9694-a3f99c6bb7a8 | 5 | public void addCells(Object[] cells)
{
if (cells != null)
{
Collection<Object> remove = null;
if (singleSelection)
{
remove = this.cells;
cells = new Object[] { getFirstSelectableCell(cells) };
}
List<Object> tmp = new ArrayList<Object>(cells.length);
for (int i = 0; i < cells.length; ... |
0b75a520-51bd-4bde-a0fa-ef4f6d13bbfd | 7 | public ArrayList<Move> getPossibleMoves()
{
ArrayList<Move> possibleMoves = new ArrayList<Move>();
for(int i = -1; i <= 1; i += 2)
{
for(int j = -1; j <= 1; j += 2)
{
boolean openSpace = true;
int count = 1;
while(openSpace)
{
Location currentLoc = new Location(getLoc().getRow(... |
e5b15a11-7b60-420d-b64d-ce42b5cea1f5 | 7 | public void testValueCollectionRemoveAllTCollection() {
int[] keys = {1138, 42, 86, 99, 101, 727, 117};
long[] vals = new long[keys.length];
TIntLongMap map = new TIntLongHashMap();
for ( int i = 0; i < keys.length; i++ ) {
vals[i] = keys[i] * 2;
map.put( keys[i]... |
02f16274-22ab-44ab-9f29-58cfca730cbf | 8 | public final SymbolraetselASTParser.sym_return sym() throws RecognitionException {
SymbolraetselASTParser.sym_return retval = new SymbolraetselASTParser.sym_return();
retval.start = input.LT(1);
CommonTree root_0 = null;
Token SYMBOL2=null;
CommonTree SYMBOL2_tree=null;
... |
6eb225a7-0749-425c-8102-493a090eb71a | 1 | public void addFreq(String word)
{
mFreq++;
if (Character.isUpperCase(word.charAt(0)))
mCapitalFreq++;
} |
69aacd06-6ad9-41c2-bf37-e4d845136c16 | 7 | public ArrayList<ArrayList<Integer>> fourSum(int[] num, int target) {
ArrayList<ArrayList<Integer>> result = new ArrayList<ArrayList<Integer>>();
int size = num.length;
ValueIndexPair[] twoSums = new ValueIndexPair[(size - 1) * size / 2];
int twoSumsSize = 0;
for (int i = 0; i... |
8c813124-d4d2-466b-b70a-5a3e54ada221 | 9 | public void genNewIndividual(int parent)
{
Genome child;
Genome tmp;
Genome tmp2;
RNG die = RNG.getInstance();
a1 = die.nextInt(individual.size());
a2 = die.nextInt(individual.size());
a3 = die.nextInt(individual.size());
a4 = parent;
/* child = a1 + Xover(a2 - a3) */
child = individual.ge... |
3544c673-0fed-4575-a6b7-ac798207365b | 2 | public BoundedGrid(int rows, int cols)
{
if (rows <= 0)
throw new IllegalArgumentException("rows <= 0");
if (cols <= 0)
throw new IllegalArgumentException("cols <= 0");
occupantArray = new Object[rows][cols];
} |
dae266e7-cad9-41a6-9548-bc9b845c171b | 4 | public Simulator() {
for (int i=0; i<6; i++)
{
if (i<2)
{
employees[i]=new TastebudStylist(500);
}
else if (i<4)
{
employees[i]=new Moover(200);
}
else if (i<6)
{
employees[i]=new Shaker(100);
}
}
week=0;
} |
d05b5352-253e-4211-9d3f-7c1f8b9ad0ff | 7 | @Override
protected boolean handleEvent(Event evt) {
if(evt.isMouseEventNoWheel()) {
if(dragActive) {
if(evt.isMouseDragEnd()) {
if(listener != null) {
listener.dragStopped(this, evt);
}
... |
3716e4be-db59-406d-8d3e-cf0e70a7c42e | 5 | public static void main(String[] args) {
int sum = 0;
HashSet<Integer> prods = new HashSet<Integer>();
for(int i = 2; i < 10_000; i++) {
for(int j = i+1; j < 10_000; j++) {
int k = i*j;
if( isPan(i, j, k) ) {
boolean added = prods.add(k);
System.out.printf("%6d%6d%6d", i, j, i*j);
if... |
03ca1d9c-535b-44bd-ae20-9b3d6a2f90ed | 3 | public boolean hasReturnTypeMethod(String name, Class<?> returnType, Class<?>... argTypes) {
Preconditions.hasText(name);
Preconditions.notNull(returnType);
try {
return null != returnTypeMethod(name, returnType, argTypes);
} catch (Exception e) {
return false;
}
} |
070eddb4-4d71-4654-86f1-0cb4c05f0118 | 8 | public void drawCell(mxICanvas canvas, Object cell)
{
mxCellState state = graph.getView().getState(cell);
if (state != null
&& isCellDisplayable(state.getCell())
&& (!(canvas instanceof mxGraphics2DCanvas) || hitClip(
(mxGraphics2DCanvas) canvas, state)))
{
graph.drawState(canvas, state... |
466fb387-8c80-4318-b542-682cd4fc574f | 1 | public boolean isWorldLoaded(String world) {
if (world.equalsIgnoreCase(loadedWorld)) {
return true;
} else {
return false;
}
} |
123c9269-492e-471e-8d58-8e5d3a2c17bb | 4 | private void findFromPoint(Point p, List<Point> curPath) {
curPath.add(p);
if(isFinalPoint(p)){ //recursive stop point
pathes.add(curPath);
return;
}
if(MAZE.isRoad(p.X + 1, p.Y)){
findFromPoint(new Point(p.X + 1, p.Y), new ArrayList<Point>(curPath));
}
if(MAZE.isRoad(p.X, p.Y + 1)){
findFromPoi... |
10c2a84c-8db8-4557-8167-2ee1624dc988 | 7 | public ArrayList<ArrayList<Integer>> permute(int[] num) {
ArrayList<ArrayList<Integer>> result = new ArrayList<ArrayList<Integer>>();
int n = num.length;
if (n == 0){
return result;
}
if (n == 1){
ArrayList<Integer> t = new ArrayList<Integer>();
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.