method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
fde56c73-c15c-471a-bab4-e60e6407d5b6 | 6 | public Network(Layer[] layers) {
// проверки
if (layers == null || layers.length == 0) throw new IllegalArgumentException();
// проверим детально
final int size = layers.length;
for (int i = 0; i < size; i++)
if (layers[i] == null || (i > 1 && layers[i].getInputSize()... |
6c457686-51c0-4405-bc90-5863a9bee7ff | 8 | public void draw(Graphics surface) {
// Draw the object
surface.setColor(color);
surface.fillRect(x - SIZE / 2, y - SIZE / 2, SIZE, SIZE);
surface.setColor(Color.BLACK);
((Graphics2D) surface).setStroke(new BasicStroke(3.0f));
surface.drawRect(x - SIZE / 2, y - SIZE / 2, SIZE, SIZE);
// Move the center o... |
fc2e021d-d0d6-4c75-b72f-8a7d6bdea057 | 9 | public static Vault getPlayerVault(String player, int id)
{
if(hasCachedVault(player, id))
{
return getCachedVault(player, id);
}
Vault vault = new Vault(Config.getConfig().getInt("vault-rows"), player, id);
if(BackendType.equals(Backends.MySQL))
{
ResultSet results = sqlConnection.dbStm("SELECT * FR... |
65463cee-2586-405c-9b6a-f16ca06f6816 | 0 | @Override
public int count() {
return _source.length;
} |
ee37c0fe-d3f2-4628-a716-7b61d94c6724 | 2 | private static void writeBestOrganism() throws Exception {
String path = "bestOrganism.txt";
EcritureTXTfichier toFile = new EcritureTXTfichier(path);
toFile.writeToFile(path);
List< List<Double>> answers_results = new ArrayList<>();
answers_results = neatANN.getBestOrganismAnsw... |
e0c2817f-bfa8-41ae-93c0-095509267cfb | 7 | public void seeQuizScore(User user){
List<Quiz> quizes = new ArrayList<Quiz>();
// initialise quiz model
QuizModel quizM = new QuizModel();
// list of all user quizes
quizes = quizM.getUserList(user.getId());
int i = 1;
try{
if(quizes.get(0).getId()>0){
UserInputManager inpM = new UserInp... |
1231b1d2-3a22-4510-a383-f90aae8ea276 | 9 | public static void main(String[] args) {
if (args.length < 1) {
System.out.println("USAGE: wc file");
System.exit(1);
}
Reader reader = null;
try {
reader = new FileReader(args[0]);
int nl = 0, nw = 0, nc = 0;
int data;
boolean inWord = false;
while ((data = reader.read()) != -1)... |
a20d694e-a247-4a13-b2fd-de6c60f23b3b | 1 | private void updateKeys()
{
for (int key = 0; key < keys.length; key++)
{
lastKeys[key] = keys[key];
keys[key] = Keyboard.isKeyDown(key);
}
} |
bac47980-4bc4-4fc3-8191-221490a4651c | 4 | private JList<FolderConfig> buildLeftSideList(final JPanel left) {
final DefaultListModel<FolderConfig> listModel = new DefaultListModel<FolderConfig>();
final JList<FolderConfig> list = new JList<>(listModel);
if (!GuiUtils.syncConfig.getConfigs().isEmpty()) {
for (final FolderConfig folder : GuiUtils.syncCo... |
b079aa5e-e09b-45f2-9391-0df53610e3de | 7 | private void doCloseCommand(CommandSender sender, Command cmd, String label, String[] args) {
if(sender instanceof Player) {
ItemStack item = ((Player) sender).getItemInHand();
BookMeta meta = null;
Matcher titleMatcher = null;
if(item.getType() == Material.WRITTEN_BOOK) {
meta = (BookMeta) item.getIt... |
b1a268ca-38b2-48eb-b076-00ad7d5a5243 | 7 | void sortList(List<Integer> list, int k)
{
if(k == 0) return;
int val = list.get(0);
List<Integer> leftList = new ArrayList<Integer>();
List<Integer> rightList = new ArrayList<Integer>();
int left = 0;
int right = 0;
for(int i = 1; i<list.size(); i++){
if(list.get(i)<val){
leftList.add(list.get... |
0984484e-e752-4649-a3f6-e932029bed3a | 8 | public void putAll( Map<? extends K, ? extends Character> map ) {
Iterator<? extends Entry<? extends K,? extends Character>> it = map.entrySet().iterator();
for ( int i = map.size(); i-- > 0; ) {
Entry<? extends K,? extends Character> e = it.next();
this.put( e.getKey(), e.getVa... |
0a40475d-385f-4e26-9885-aaf42350349c | 2 | @Override
public String getElementAt(int index) {
if(getSize() <= 0 || getSize() <= index) {
return "Ups,not that many Entries!";
}
return FW.getObjectNames().get(index);
} |
5dddfcc4-269b-4807-9178-d898fb235259 | 6 | public void startmaingame() {
if (k != 10 && k >= 1) {
k--;
}
else if (k == 0 && introduction == 0) {
k = 10;
getWorld().removeObjects(getWorld().getObjects(Blowfish.class));
getWorld().removeObjects(getWorld().getObjects(Jellyfish.clas... |
bfbdce37-f5e6-408f-8383-b96d12f03c10 | 6 | private void updateLists() {
for (int i = 0; i < spaceJunk.size(); i++) {
spaceJunk.get(i).update();
}
for (int i = 0; i < planets.size(); i++) {
planets.get(i).update();
}
for (int i = 0; i < bullets.size(); i++) {
bullets.get(i).update();
... |
b2e4d7c5-1ad2-4f40-87e0-a4d946f2a7f2 | 9 | public MessageBuilder build() {
for (String sender : this.senders) {
String message = this.message;
Config messages_config = this.message_config;
String finalmessage;
if (messages_config != null) {
if (messages_config.getFile().get(message) != null) {
finalmessage = (String) messages_conf... |
8fbcc9eb-b7ed-4f02-8571-1999df5f7721 | 2 | private void checkForPopup(MouseEvent e) {
if (e.isPopupTrigger()) {
int tabNumber = pane.getUI().tabForCoordinate(pane, e.getX(), e.getY());
if (tabNumber >= 0) {//must be a tab
Component c = e.getComponent();
menu.setCurrentTab(tabNum... |
721a905a-5e59-4257-8613-0d5b1cb7410c | 2 | public static double frechetCDF(double mu, double sigma, double gamma, double lowerlimit, double upperlimit) {
double arg1 = (lowerlimit - mu) / sigma;
double arg2 = (upperlimit - mu) / sigma;
double term1 = 0.0D, term2 = 0.0D;
if (arg1 >= 0.0D) term1 = Math.exp(-Math.pow(arg1, -gamma));
if (arg2 >= 0.0D) ter... |
6e08344f-0132-42ec-8a77-c67b28481832 | 0 | public void setSex(String sex) {
this.sex = sex;
} |
059bd88c-adf4-47bf-b508-41deafe8fd6c | 1 | private boolean jj_3R_34() {
if (jj_3R_23()) return true;
return false;
} |
1a2ae67f-23e8-4adb-b8f9-5cdc9f4ee6bf | 8 | public void processEvent(AWTEvent paramAWTEvent)
{
super.processEvent(paramAWTEvent);
if (((paramAWTEvent instanceof MouseEvent)) && (this.EventTransparent))
{
MouseEvent localMouseEvent1 = (MouseEvent)paramAWTEvent;
Container localContainer = getParent();
Component[] arrayOfComponent ... |
ef72f85c-1b86-42bf-98d1-34c696f29716 | 4 | public static String unescape(String in) {
StringBuilder out = new StringBuilder();
char last = 0;
for (char c : in.toCharArray()) {
if (c == ESC) {
if (last != 0 && last == ESC)
out.append(c);
}
else
out.ap... |
5d6f7ba1-9526-4ac8-9f39-3cf56dfc6295 | 8 | public void paintComponent(Graphics g)
{
// Get the Graphics2D version of the Graphics g by casting
Graphics2D g2 = (Graphics2D) g;
// Represents the width and the x coordinate of drawing the red and white
// rectangles in the panel. Initially set to the value of drawing the
// rectangles to the right of... |
c0982b08-9282-4025-bb17-bcdd3767220b | 9 | public boolean createDirToLocal(String parentPath, String dirName) {
try {
String dirPath;
if (parentPath.length() == user.getUsername().length() + 1) { // username\
dirPath = parentPath + dirName;
} else { // username\***
dirPath = parentPath + "\\" + dirName;
}
//System.out.println(dirPath... |
600d6c12-21f6-4cec-bdc3-7650d0576cec | 1 | protected static int toUByte(final byte b) {
return b < 0 ? b + 0x100 : b;
} |
bb21981a-5038-458f-8931-cb4770b70fcb | 4 | void saveFile() {
if (fileName != null) {
FileWriter file = null;
try {
file = new FileWriter(fileName);
file.write(styledText.getText());
file.close();
} catch (IOException e) {
showError(getResourceString("Error"), e.getMessage());
} finally {
try {
... |
24ce059a-abf8-416c-8473-67003844593d | 8 | @Override
public void onPlayerCommandPreprocess (PlayerCommandPreprocessEvent event) {
Player player = event.getPlayer();
String command = event.getMessage();
String[] split = command.split(" ");
if (!event.isCancelled() && split[0].equalsIgnoreCase("/backup")) {
event.se... |
99fc095b-50d3-4593-820c-8ebb4ee7075a | 6 | public Boolean doubleRotation(privAVLNode r,int dir)
{
//Check valid inputs
if(!(dir == 1 || dir == 0))
return false;
if(r == null)
return false;
privAVLNode save1 = r.getChild(dir);
if(save1 == null)
return false;
privAVLNode save2 = save1.getChild((dir+1)%2);
if(save2 == null)
r... |
a1c46b69-45ef-4b32-9201-2ef4fe12b9dc | 2 | public String getOrdGroopString()
{
// Construct the groop string
Collection<String> main = getMainGroops();
Iterator<String> gIt = main.iterator();
StringBuffer groop = new StringBuffer("");
while (gIt.hasNext())
groop.append(gIt.next() + " & ");
// Remove the trailing ... |
c628de45-9759-40d9-8b2c-980cdec6de1b | 3 | public void run(){
if (!armChannel.getAnimationName().equals("ArmRun") && !hasSwung){
armChannel.setAnim("ArmRun");
}
if (!legChannel.getAnimationName().equals("LegRun")){
legChannel.setAnim("LegRun");
}
} |
d32203bd-c031-4889-8318-811190b04918 | 9 | public void scanFileCollection(File src){
if (src.isDirectory()){
for (File child: src.listFiles())
scanFileCollection(child);
}
else{
try {
//Deal with artist tag
String artist = MetadataParser.getArtist(src);
if(artist!=null){
int origSize=artistNames.size();
artist... |
1f4e6474-af59-4235-ae4a-1711e33f4a4a | 5 | private void logPage(){
logPane = new JPanel();
logPane.setBackground(SystemColor.activeCaption);
logPane.setLayout(null);
JLabel lblTreatmentLog = new JLabel("Treatment Log");
lblTreatmentLog.setHorizontalAlignment(SwingConstants.CENTER);
lblTreatmentLog.setFont(new Font("Arial", Font.BOLD, 30));
lblT... |
286a0af9-e3cb-4a83-a9d2-a03ad6f94f04 | 5 | private void findNeighbors(BKTree<? extends T> root, List<? super T> neighbors) {
T rhs = root.getValue();
int crntDistance = distance.compare(center, rhs);
if (crntDistance < tolerance) {
neighbors.add(rhs);
}
for (int x = crntDistance - tolerance; x <= crntDistance... |
775cc460-6ecb-4a85-a3f7-c1ac489fc9b6 | 6 | private void createAndShowTipWindow(final MouseEvent e, final String text) {
Window owner = SwingUtilities.getWindowAncestor(textArea);
tipWindow = new TipWindow(owner, this, text);
tipWindow.setHyperlinkListener(hyperlinkListener);
// Give apps a chance to decorate us with drop shadows, etc.
PopupWindowDec... |
15daf7e1-10ba-42c5-b8a0-dfca2f171d9e | 1 | public void decrementFood() {
if (this.food > 0) {
this.food--;
}
} |
ab049a5c-07dc-40c7-b370-5053e9d5fbb4 | 4 | public void testCopyRecursivelyFromJar() throws IOException {
Debug.println("fileio", " my tmpdir = " + tmpDir);
File targetFoo = null, targetBar = null,
newDestDir = null;
File jarFile = new File(tmpDir, "test.jar");
try {
JarOutputStream jf =
new JarOutputStream(new ... |
09fdde13-79a2-4be4-82a1-a1317fc47c8e | 1 | public void printAnalysisResultsEP() {
String string = "";
for (int i = 0; i < bestSequenceAlternativesEnergyPoint.size(); i++)
string += i + ": " + bestSequenceAlternativesEnergyPoint.get(i) + "CONSUMPTION:" + consumptionEnergyPoints[i] + "EP\n";
System.out.println(string);
} |
a80b7111-081d-4edb-a8b0-58ec77a19d6d | 4 | public static int phi(int num) {
if (num == 1)
return 1;
if (isPrime(num))
return num-1;
if (num % 2 == 0) { //using 2 identity
num /= 2;
return (num % 2 == 0 ? 2 : 1) * phi(num);
}
//this is the identity:... |
8896761a-11f9-4eaa-81e6-45c6221584ba | 9 | private int scanLongstring()
{int count = 0, countaux = 0;
//Neste ponto ja verificou que esta usando colchete e ja aceitou para diferenciar em scanToken() o =
while(currentChar == '=')
{
takeIt();
count++;
}
take('[');
while(currentChar != SourceFile.EOT) //A condicao de parada ... |
109cc1e5-9068-422f-8cd5-bb6b4b898aac | 1 | private FileWatcherService(List<String> watchedFiles,EventBus eventBus)
{
try
{
watcher = FileSystems.getDefault().newWatchService();
this.eventBus = eventBus;
register(watchedFiles);
INSTANCE = this;
}
catch (Exception e)... |
66cf74a2-5868-45dc-a5ba-ab968a3b11e0 | 0 | public void setColor(Color color) {
this.color = color;
} |
dd3140c1-7f61-44df-8d21-77da0370678d | 3 | public void listenUsersHands() throws InvalidSubscriptionException,
IOException {
waitHandsSub = elvin.subscribe(NOT_TYPE + " == '" + BROADCAST_HAND
+ "' && " + GAME_ID + " == '" + gameHost.getID() + "'");
waitHandsSub.addListener(new NotificationListener() {
public void notificationReceived(Notificatio... |
2576d984-beba-4dbb-b135-c9b92ebc9666 | 0 | @Basic
@Column(name = "PRP_ESTADO")
public String getPrpEstado() {
return prpEstado;
} |
634bf6e6-3cc9-4725-b74b-fcda547cfeee | 8 | public ServletManager(CWConfig config)
{
servlets = new Hashtable<String,Class<? extends SimpleServlet>>();
servletStats = new Hashtable<Class<? extends SimpleServlet>, RequestStats>();
servletInit = new Hashtable<Class<? extends SimpleServlet>, Boolean>();
for(final String context : config.getServlets().ke... |
cd35da44-2ccb-4bb6-a46d-8f542bf7c396 | 3 | public void addUnit(core.GroupOfUnits unit, List<core.GroupOfUnits> list, QListWidget widget)
{
boolean found = false;
int i=0;
for (core.GroupOfUnits u: list) {
if (u.type == unit.type) {
u.setNumber(u.getNumber() + unit.getNumber());
widget.item(i).setText(u.type.name + " ("+u.getNumber()+")");
... |
6eb431bd-b8fc-41c5-a05c-b9b4ab296232 | 1 | private boolean jj_3R_31() {
if (jj_3R_72()) return true;
return false;
} |
760500cc-78da-4aa3-a99d-068fdc0eb62f | 3 | private void Update()
{
if(timeForNextFrame <= System.currentTimeMillis())
{
// Next frame.
currentFrameNumber++;
// If the animation is reached the end, we restart it by seting current frame to zero. If the animation isn't loop then we set that animation isn't a... |
04f6270d-9358-40ae-b344-74f37c467fe5 | 5 | private boolean camposCompletos (){
if((combo_tipo.getSelectedIndex()>=0)&&
(fecha.isFechaValida(field_desdee.getText()))&&
(fecha.isFechaValida(field_hasta.getText()))&&
(!field_tasa.getText().equals(""))&&
(!field_sobretasa.getText().equals(""))
){
... |
a995286b-54a8-4ebd-941a-4232a8cebaad | 0 | private void statementBlock()
{
expect(Token.Kind.OPEN_BRACE);
statementList();
expect(Token.Kind.CLOSE_BRACE);
} |
6f32273a-8a15-4709-8a0f-13bb49175fb3 | 0 | public static void DisplayLogin(Login login,ServerAccountConfig accountconfig){
System.out.println("--------------------------");
System.out.println("New Client Login");
System.out.println("--------------------------");
System.out.println("Account : " + login.Account);
System.out.println("SPNum : " + ac... |
c2c4cf80-c053-4447-b69b-ed0bb0ce1969 | 1 | public static void updateCommercial(int id, int idservice, int idville, String nom, String prenom, String adresse1, String adresse2) throws SQLException {
int result;
String query;
try {
query = "UPDATE COMMERCIAL set ID_VILLE=?,COMMNOM=?,COMMPRENOM=?,COMMADRESSE1=?,COMMADRESSE2=? wh... |
3b925bf0-0f22-4b52-ad79-912311c44ae1 | 4 | public boolean on( int x, int y )
{
return !(x < 0 || y < 0 || x >= width || y >= height) && (mask[y][x] == _);
} |
7beb42d2-9e74-4074-bdea-0e600da53bd1 | 9 | public void body()
{
// Gets the PE's rating for each Machine in the list.
// Assumed one Machine has same PE rating.
MachineList list = super.resource_.getMachineList();
int size = list.size();
machineRating_ = new int[size];
for (int i = 0; i < size; i++) {
... |
b9cbf8b3-078d-495f-bb67-14b95806da85 | 6 | private void validerMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_validerMouseClicked
// TODO add your handling code here:
if (jrbHel.isSelected()) {
choix = 0;
} else if (jrbSurt.isSelected()) {
choix = 1;
} else if (jrbJormungand.isSelected()) {... |
411af5a3-686b-4e4f-806d-3052754de98d | 8 | private int paethPredictor(byte[] line, byte[] previousLine, int x, int xp) {
int a = 0xFF & ((xp < 0) ? 0 : line[xp]);
int b = 0xFF & previousLine[x];
int c = 0xFF & ((xp < 0) ? 0 : previousLine[xp]);
int p = a + b - c;
int pa = (p >= a) ? (p - a) : -(p - a);
int pb = (p >= b) ? (p - b) : -(p - b);
int ... |
1ab9c72d-9a7f-4fa4-8ccb-68bb4a2db608 | 6 | public static Stella_Object accessBacklinksIndexSlotValue(BacklinksIndex self, Symbol slotname, Stella_Object value, boolean setvalueP) {
if (slotname == Logic.SYM_LOGIC_DEPENDENT_PROPOSITIONS_LIST) {
if (setvalueP) {
self.dependentPropositionsList = ((SequenceIndex)(value));
}
else {
... |
8ddee5a4-3485-4706-aab0-05aa1ecf8c02 | 8 | @Override
public boolean isMoveValid(int srcRow, int srcCol, int destRow, int destCol) {
// TODO Auto-generated method stub
boolean result = false;
if(
((destCol == (srcCol - (srcCol - destCol))) && (destRow == (srcRow + (srcCol - destCol)))) || // down left diagonal
((destCol == (srcCol + (destCol -... |
da8d94ed-2098-4066-8cf7-1a65200fae6a | 1 | public void setSortByName(boolean sort) {
if (!sortByName) {
Collections.sort(listPhoneBook, new SortedByFirstName());
sortByName = true;
} else {
Collections.sort(listPhoneBook, Collections.reverseOrder(new SortedByFirstName()));
sortByName = false;
}
} |
a296f648-af8f-4161-82bc-6b9953b92376 | 1 | public Account create() {
UUID accountId = UUID.randomUUID();
AccountImpl accountImpl = new AccountImpl(accountId);
Account newAccount = null;
try{
org.omg.CORBA.Object objRef = rootpoa.servant_to_reference(accountImpl);
newAccount = AccountHelper.narrow(objRef);
accounts.put(UUID.fromString(newAccount... |
4dd06a72-c64c-4a41-a34f-b4215d36483b | 8 | @Override
public void paint(Graphics g1) {
Graphics2D g = (Graphics2D) g1;
g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_OFF);
if (Universal.testing)
return;
if (data == null) {
if (Script.holdExecution()) {
return;
}
data = new SkillData();
}
Queue<Skil... |
75bb589b-bcd7-4594-9f27-eabaae6b5456 | 7 | public static void testValidity(Object o) throws JSONException {
if (o != null) {
if (o instanceof Double) {
if (((Double) o).isInfinite() || ((Double) o).isNaN()) {
throw new JSONException(
"JSON does not allow non-finite numbers.");
... |
bc09f6ad-f5f9-4dfa-bba7-102c8a9e7dad | 8 | public void searchMenu()
{
System.out.println("Search by what?");
System.out.println("1:Stock Number");
System.out.println("2:Category");
System.out.println("3:Manufactuer");
System.out.println("4:Model Number");
System.out.println("5:Description");
System.out.println("6:Accessory");
int input = scanne... |
039fd46b-071c-4c0c-a078-525fc5a88dac | 1 | public static void kill() {
runGC = false;
for (int i = 0; i < 200; i++) {} // Just wait a bit
gc.interrupt();
} |
65ff7ee5-9924-4ea9-b3cd-b6031bb02b13 | 5 | @SuppressWarnings("unchecked")
public String loadEvents() {
PreparedStatement st = null;
ResultSet rs = null;
JSONArray json = new JSONArray();
try {
conn = dbconn.getConnection();
st = conn.prepareStatement("SELECT * FROM events");
rs = st.execute... |
afafb0b8-4dfb-4561-989d-41d2555d8bb7 | 6 | public float getindiTakings(Date date, Movie movie) {
indiTakings = 0;
for(ShowTime st : movie.getShowTimes()) {
calendar.setTime(date);
int cDay = calendar.get(Calendar.DATE);
int cMonth = calendar.get(Calendar.MONTH);
int cYear = calendar.get(Calendar.YEAR);
calendar.setTime(st.getTime());
... |
94193a88-b29c-4cbe-9e0d-cb32c5e48ef9 | 9 | public String toString()
{
String res = "";
for (int i = 0; i < this.hauteur; i++)
{// Parcours le premier tableau
for (int j = 0; j < this.largeur; j++)
{// Parcours le second tableau
switch (this.background[i][j])
{
case MUR : res = res +"M"; break;
case HERBE : res = res +"H"; break... |
7f97f041-47c7-4a13-a241-1e7f171de1fd | 7 | private void startThread() throws Exception {
if (secureInstance.getInstance() != null) {
// Initialize a new Thread with a random ThreadGroup and a new Name
ownThread = new Thread(CodeSupSecurityManager.getInstance()
.getThreadGroup(securityKey), this,
secureInstance.getClassName() + "." + methodNa... |
7558bb49-cf6b-45b7-a10f-2f3fa25e85b1 | 7 | 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 fe... |
6a919c9c-d591-4828-8d4e-50810beb6c38 | 6 | @EventHandler
public void SpiderFastDigging(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.getSpiderConfig().getDouble("Spider.Fas... |
f49976ed-38bf-460c-aff4-874267d8ee43 | 7 | private void init() {
if (titleStyle == null) {
titleStyle = page.addStyle(null, null);
StyleConstants.setBold(titleStyle, true);
StyleConstants.setFontSize(titleStyle, Page.getDefaultFontSize() + 10);
StyleConstants.setFontFamily(titleStyle, Page.getDefaultFontFamily());
}
if (subtitleStyle == null) ... |
24c83b91-0a4a-428f-84c7-38eac75a66cb | 5 | public void initialize(boolean flag) {
int i;
int a, b, c, d, e, f, g, h;
a = b = c = d = e = f = g = h = RATIO;
for(i = 0; i < 4; ++i) {
a ^= b << 11;
d += a;
b += c;
b ^= c >>> 2;
e += b;
c += d;
c ^= d << 8;
f += c;
d += e;
d ^= e >>> 16;
g += d;
e += f;
e ^= f << 10;
... |
75ce910f-b7ee-46d7-93ee-b108e6e3bc2c | 5 | public StructuredBlock findCase(FlowBlock destination) {
for (int i = 0; i < caseBlocks.length; i++) {
if (caseBlocks[i].subBlock != null
&& caseBlocks[i].subBlock instanceof EmptyBlock
&& caseBlocks[i].subBlock.jump != null
&& caseBlocks[i].subBlock.jump.destination == destination)
return case... |
b47e1cec-e82c-4a59-a730-1405a04eeb36 | 0 | public Selector selector() {
return new SequenceSelector();
} |
260f95e8-92d5-4acb-a4cd-8f5aca88c117 | 0 | public static String createNewNameMessage(String myNewName) {
JSONObject jsonMsg = new JSONObject()
.element( "code", "4" )
.element( "name", myNewName )
;
return jsonMsg.toString();
} |
50a8e41b-bd1d-4638-add6-6ed3c26595e0 | 3 | public boolean contains(int[] cycle, int size, Main m){
boolean result = false;
for(int i=0; i<cycle.length; i++){
if(graphNodes.get(cycle[i]).getType()==_MOLECULE_){
if( m.getLibrary().get( graphNodes.get(cycle[i]).getID() ).getNumNodes() > size*10 ){
resu... |
6a4b322f-e6dd-4091-9c6d-bb21c25b98ca | 7 | @SuppressWarnings({ "rawtypes", "unchecked" })
public Object process(Object value) {
// we're processing things which are either PhpObjects or which could contain PhpObjects.
if (value instanceof PhpObject) {
PhpObject tmpPHP = (PhpObject) value;
value = tmpPHP.getRealObject();
} else if (value instanceof ... |
db511099-463e-4f41-acc3-82a18d8f568d | 6 | public ReportForeignAffairPanel(FreeColClient freeColClient, GUI gui) {
super(freeColClient, gui, Messages.message("reportForeignAction.name"));
// Display Panel
reportPanel.removeAll();
reportPanel.setLayout(new MigLayout("wrap 2", "[]push[]", "[align top]"));
for (Player ene... |
6d476511-9461-4371-9512-e2f2c65712bd | 2 | public void test_add_long_long() {
assertEquals(567L, iField.add(567L, 0L));
assertEquals(567L + 1234L * 90L, iField.add(567L, 1234L));
assertEquals(567L - 1234L * 90L, iField.add(567L, -1234L));
try {
iField.add(LONG_MAX, 1L);
fail();
} catch (ArithmeticE... |
3e08cde9-45c7-4f45-ad78-9c7a506392be | 3 | protected void configConnection(HttpURLConnection conn) {
conn.setReadTimeout(DownloadUtils.READ_TIMEOUT);
conn.setConnectTimeout(DownloadUtils.CONNECT_TIMEOUT);
Set<Entry<String, String>> entrySet = DownloadUtils.ORIGIN_EXTRA_HEADER.entrySet();
for (Entry<String, String> entry : entrySet) {
conn.setRequestP... |
9a325930-1510-4bcd-85a2-13655d33be21 | 0 | public Player(Point position, int baseSpeed, int baseForce, int healt,
int maxhealth, World currentWorld, String name, Color color,
int energy) {
super(position, baseSpeed, baseForce, healt, maxhealth, currentWorld,
name, color, energy);
} |
7bc16337-df0e-462d-ba01-52e1d5d2654d | 3 | public void applyPreserveRule(IdentifierMatcher preserveRule) {
if (preserveRule.matches(this)) {
System.err.println("preserving: " + this);
setReachable();
Identifier ident = this;
while (ident != null) {
ident.setPreserved();
ident = ident.getParent();
}
}
for (Iterator i = getChilds(); i... |
235bb966-9488-4fdc-b282-4961c9eb1a8c | 1 | public boolean jumpNeighbour(Hexpos other) {
if (jumpNeighbours().contains(other))
return true;
return false;
} |
e94999e0-8351-4500-8a2b-6b7d6756cccd | 1 | public SimplexNoise2D(long seed) {
Random random = new Random(seed);
for (int i = 0; i < 256; i++) {
mTable[i + 256] = mTable[i] = random.nextInt(256);
mTableMod12[i + 256] = mTableMod12[i] = mTable[i] % 12;
}
} |
2f48c6e7-bc5d-4c32-90ff-1864715950e3 | 7 | protected String replaceCallsToRgb(String line) {
if (line.contains("rgb(") && line.contains(")")) {
// simplify text like rgb(35,32,32)
int start = line.indexOf("rgb(") + 4;
int end = line.indexOf(")");
String sub = line.substring(start, end); // gets a string that looks like: 0,0,0
String comp[] = su... |
41f08786-670f-4844-b8d9-7537d5effeea | 8 | private static double getLambda(double clock) {
switch ((int) clock) {
case 0:
return 58.0;
case 1:
return 50.0;
case 2:
return 70.0;
case 3:
return 80.0;
case 4:
return 40.0;
case 5:
return 60.0;
case 6:
return 50.0;
case 7:
return 70.0;
default:
return 0;
}
} |
3f18510f-357a-440d-92a4-d432a9032b7a | 8 | public void loadElev(Node node) throws ParseException {
Elev el = new Elev();
NodeList childNodes = node.getChildNodes();
for (int i = 0; i < childNodes.getLength(); i++) {
Node cNode = childNodes.item(i);
if (cNode instanceof Element) {
String content = cNode.getLastChild().getTextContent().trim();
... |
e900b22d-d265-46de-b564-14cd53884a51 | 1 | public void removeSelected()
{
layout.takeAt(selectedNo).widget().dispose();
objects.remove(selectedNo);
if (checkable) {
selectedNo = 0;
((WidgetChooserButton)(layout.itemAt(selectedNo).widget())).setChecked(true);
selected(objects.get(selectedNo));
}
} |
2cd7c93b-4591-435e-8b55-100c4bd177cd | 6 | protected void drawHands(){
Card[] shelf = tm.getP1().getShelf();
for(int index=0; index<shelf.length; index++){
if(shelf[index]!=null){
shelf[index].drawCard(main, 50+index*50, 500);
}
}
Card[] flop = tm.getP1().getFlop();
for(int index=0; index<flop.length; index++){
if(flop[index]!=null){
... |
533e0438-8953-41b0-bb7b-f1dc1d3c8829 | 5 | public synchronized void decisionMessage(int senderID, DecisionMessage dm) {
console.displayMessage(senderID + " voted for " + dm.getDecision());
if (dm.getVotingID() != id) {
console.displayMessage("Got decision message with invalid voting id. Dropping message...");
return;
}
System.out.println(123);
f... |
05e9a34f-9539-4412-8a2e-d4b00948bbda | 9 | public void decodeAndRender(int id, String message) throws JSONException {
switch (id) {
case 100: // Chat message
Message chatMessage = enc.chattMessageDecode(message);
tg.chat.chatUpdate(chatMessage.message, chatMessage.user);
break;
case 201: // Move message
TiarUserMessage mess = enc.tiarUse... |
95f9f077-cfea-4ca2-a23b-090fff195530 | 7 | public static void main(String[] args) throws Exception {
String arffFile = "/home/abrari/Tesis/GP-Experiment/data/Gm01.arff";
CSVReader reader = new CSVReader(new FileReader(arffFile), ',', '\'', 21);
String[] line;
double[] d;
// 0 = true, 1 = false
int predicted;
... |
e8292b68-72ea-46d2-b0e1-7c31467ef60b | 5 | public boolean add(Order order)
{
Session s = sessionManager.getSession();
try
{
if (!s.executeNonQuery("insert into Orders (VendorID, BaseID, OrderTime, Amount) values(?, ?, ?, ?)"
, order.getVendor().getId(), order.getPizzaBase().getId(), order.getOrderTime().getTime(), ((Float)order.getAmount()).doub... |
375ec9bd-8325-4f8e-8511-ce267c235cbe | 0 | protected AutomatonDrawer getDrawer() {
return drawer;
} |
2fa3f71a-ef47-45e4-a543-89aaa4420aa2 | 0 | public SystemLogger() {
super(fileOut);
System.setOut(this);
System.setErr(this);
} |
6069fde2-0e2d-466e-8638-7d32b5c37caa | 1 | public static ConnectionManager Instance()
{
if (ConnectionManager.manager == null)
{
ConnectionManager.manager = init();
}
return ConnectionManager.manager;
} |
ee54c062-9172-4547-9da2-071545434c5e | 3 | static void nativeLF() {
try {
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
String osName = System.getProperty("os.name");
if ((osName != null) && osName.toLowerCase().startsWith("lin")) {
UIManager.setLookAndFeel("com.sun.java.swing.pl... |
8913b4ed-f4fe-4227-9418-8c606fe8c16c | 0 | public boolean isVertical() {
return isVertical;
} |
bdec469f-ecbe-421f-8ca3-c2614b172470 | 0 | @Override
public int compareTo(Element o) {
Integer size = this.value;
Integer osize = o.getValue();
return size.compareTo(osize);
} |
046ac749-47da-4d0c-b7d5-3fa82cf1330e | 9 | private int GetLogicActionSmrad(WumpusPolje[][] wumpusWorld){
if(tmpPolje.m_smrad){
//Down
if(tmpPolje.m_x + 1 < wumpusWorld.length && tmpPolje.m_y - 1 >= 0){
if(obiskanaPolja.contains(wumpusWorld[tmpPolje.m_x + 1][tmpPolje.m_y - 1]) && !wumpusWorld[tmpPolje.m_x + 1][tmpPolje.m_y - 1].m_smrad){
... |
4710637b-fe1f-4156-adb8-3a28a73e1cfa | 3 | public String getFeatureValue(String featureType) throws FeatureTypeNotFoundException {
String featureValue = "";
String[] singleFeatureTypes = featureType.split(Const.splitChar);
for (String singleFeatureType : singleFeatureTypes) {
if (features.containsKey(singleFeatureType)) {
if (featureValue.isEmpt... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.