method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
d159c176-e707-481f-ae2d-2b072b2332bc | 2 | public void addLongBranch(final Label label) {
if (ClassEditor.DEBUG || CodeArray.DEBUG) {
System.out.println(" " + codeLength + ": " + "long branch to "
+ label);
}
branchInsts.put(new Integer(codeLength), new Integer(lastInst));
longBranches.put(new Integer(codeLength), label);
addByte(0);
add... |
b19f5f47-776e-45c9-94bb-3ee489dc34d7 | 7 | public static float findSumOfAction(float sum, int action, float dataValue){
if (action == 0){
sum = sum + dataValue;
}
if (action == 1){
sum = sum - dataValue;
}
if (action == 2 && sum != 0){
sum = sum * dataValue;
}
if (action... |
efe2cf93-4e05-4d30-bb76-7d21cc0370a4 | 6 | public Set<String> getRulesToDerive(Set<Literal> literals) {
Set<Literal> literalsChecked = new TreeSet<Literal>();
Set<Literal> literalsToCheck = new TreeSet<Literal>();
Set<Literal> literalsToAdd = new TreeSet<Literal>();
Set<String> rulesExtracted = new TreeSet<String>();
literalsToAdd.addAll(getLiteralsT... |
67b7db9c-7a35-47bb-90c3-67b858706019 | 5 | public void keyPressed(int k) {
if(k == KeyEvent.VK_LEFT) player.setLeft(true);
if(k == KeyEvent.VK_RIGHT) player.setRight(true);
if(k == KeyEvent.VK_UP) player.setUp(true);
if(k == KeyEvent.VK_DOWN) player.setDown(true);
if(k == KeyEvent.VK_Z) player.setPummeling();
} |
553eeaa8-8ee4-42a3-bbcb-ce2acf78a432 | 9 | public void paint(Graphics g) {
for (Element<?> e : _lightElements) {
if (((Light)e.x).getColor() == LightColor.GREEN) {
g.setColor(Color.GREEN);
}
else if (((Light)e.x).getColor() == LightColor.YELLOW) {
g.setColor(Color.YELLOW);
}
else {
g.se... |
d37b6a4a-7c48-4627-9417-0c0a35c08e32 | 3 | public V doit() {
PreparedStatement stmt = null;
V out = null;
con = null;
try {
con = connectionPool.getConnection();
stmt = con.prepareStatement(mSQL);
out = process(stmt);
} catch( SQLException e ) {
e.printStackTrace();
logger.warning(e.toString());
}
finally {
... |
6ff32817-9741-4819-9bc2-2156995a6545 | 4 | private Factor parseFactor() {
//System.out.println("parseFactor");
Factor factor = null;
switch (showNext().getKind()){
case "ident":
factor = new IdentSelector();
((IdentSelector) factor).setIdent(new Identifier(acceptIt()));
((IdentSelector) factor).setSelector(parseSelector());
break;
case "in... |
200c86bd-b786-40af-b8f2-ceadf5e7a31b | 2 | @Override
public void handleOutputCommand(SoarBeanOutputContext context, DriveCommand driveCommand) {
if (shuttingDown) {
return;
}
short velocity = (short) driveCommand.velocity;
short radius = (short) driveCommand.radius;
context.setS... |
9d8e8ce1-a2f7-4219-b1e9-d72902263e7e | 4 | @Override
public boolean equals(Object other) {//@formatter:off
return (other == this) ? true
: (other == null) ? false
: (other instanceof Cell) ? equal(((Cell) other).x, x) && equal(((Cell) other).y, y)
: false;
}//@formatter:on |
2ab18f23-d4e1-415f-aa58-3e0b4cd5caa7 | 6 | private void sortEntities(){
int square;
//Go through every row and sorts the entityRows list
for(int i = 0; i < Constants.TILE_AMOUNT_Y; i++){
square = (i)*32;
for(Entity e: entities){
if(e.getY() >= square && e.getY() < square+32){
entityRows.get(i).add(e);
}
}
}
... |
1cb95f5c-0d14-4b3f-a746-328f7fa5bad7 | 1 | public void testConstructor_ObjectStringEx4() throws Throwable {
try {
new MonthDay("10:20:30.040+14:00");
fail();
} catch (IllegalArgumentException ex) {
// expected
}
} |
5f99434d-1051-4cff-a98e-2dccae7536a1 | 7 | @Override
public void executeMsg(final Environmental myHost, final CMMsg msg)
{
if((msg.amITarget(littlePlantsI))
&&(!processing)
&&((msg.targetMinor()==CMMsg.TYP_GET)||(msg.targetMinor()==CMMsg.TYP_PUSH)||(msg.targetMinor()==CMMsg.TYP_PULL)))
{
processing=true;
final Ability A=littlePlantsI.fetchEffect... |
3820a433-0191-4005-90fe-e384c9f4488d | 4 | public int dxLookback( int optInTimePeriod )
{
if( (int)optInTimePeriod == ( Integer.MIN_VALUE ) )
optInTimePeriod = 14;
else if( ((int)optInTimePeriod < 2) || ((int)optInTimePeriod > 100000) )
return -1;
if( optInTimePeriod > 1 )
return optInTimePeriod + (this.unstablePe... |
ba1ba5d5-4f7f-4df3-b786-d106e5b3580a | 0 | public void setRequestMethod(Method requestMethod) {
this.requestMethod = requestMethod;
} |
d9c39738-48a8-4966-adb5-43c931ebde34 | 3 | void mapInVal(Object val, Object to, String to_in) {
if (val == null) {
throw new ComponentException("Null value for " + name(to, to_in));
}
if (to == ca.getComponent()) {
throw new ComponentException(
"field and component ar ethe same for mapping :" + to_in);
}
ComponentAccess ca_to = lookup(to);
... |
bf88798c-da42-44b1-8af3-8b03ff3eae0c | 2 | @Override
public void paint(Graphics g) {
super.paint(g);
this.setBackground(Color.BLACK);
this.setDoubleBuffered(true);
g.setColor(gameOverColor);
drawLists(g);
drawHints(g);
drawScore(g);
if (isTeleport) {
teleport.draw(g);
}
... |
d966ddf8-ec9a-4fb1-84d6-a1667162ecd8 | 2 | public void receiveMessage(String msg)
{
mailbox.add(msg);
if (myWindow != null)
{
while (hasMessages()) {
myWindow.showMessage(mailbox.remove());
}
}
} |
1d32eb03-8dd2-4e33-b699-26e489378c73 | 8 | public static void main(String[] args) {
List<List<Scheduler>> all_schedulers = new LinkedList<List<Scheduler>>();
int as_time=4, as_period=10;
System.out.println("Aperiodic Server (c="+as_time+",p="+as_period+")\t\t\t\t i=Number of aperiodic tasks where start=0, c=2");
System.out.println("i\tFinish Time\t\t\... |
c7d1c99f-93f0-431b-bcb0-6bf1ba209e0e | 0 | public DiskMgrException(Exception e, String name)
{
super(e, name);
} |
494de1b3-1f90-404e-900e-f5c3775abd91 | 1 | public void createDecal(SimpleVector pos, SimpleVector normal) {
Decal decal=getFreeDecal();
if (decal!=null) {
Matrix m=normal.getRotationMatrix();
decal.place(pos);
decal.rotate(m);
}
} |
179dd5e1-883e-4014-bd6b-110da0cef3b0 | 2 | public void start()
{
try {
Display.setDisplayMode(new DisplayMode(800, 600));
Display.create();
} catch (LWJGLException e) {
e.printStackTrace();
System.exit(0);
}
//Init Open GL here
while (!Display.isCloseRequested())
{
//Render Open GL here
Display.update();
}
Display.des... |
d3fd5f5e-8f26-4641-b1c7-42a179db0ebf | 7 | public void addLegalValue(String value, String desc, String mapto) throws MaltChainedException {
if (value == null || value.equals("")) {
throw new OptionException("The legal value is missing for the option "+getName()+".");
} else if (legalValues.contains(value.toLowerCase())) {
throw new OptionException("Th... |
207a511b-da24-43d6-babe-d4fa5afa73bb | 2 | public Vector<Camera> getCamerasByTag(String Tag)
{
Vector<Camera> cams = new Vector<Camera>();
for(Camera camera : this.Cameras)
{
if(camera.getTag().equals(Tag))
{
cams.add(camera);
}
}
return cams;
} |
70131307-5a5c-4e34-b50c-1390f982678f | 8 | public ArrayList<ISuggestionWrapper> addCharacter() {
ArrayList<ISuggestionWrapper> suggestions = new ArrayList<ISuggestionWrapper>();
initiateFromExhaustedNodes();
Link nextLink = getNextLink();
currentNodeVisitations = 1;
while(neededSuggestions - suggestions.size() > 0 && next... |
647d1b7a-828c-4b22-8a7a-dd620ae55508 | 6 | public void initialize() {
textField.setColumns(10);
frame = new JFrame();
frame.getContentPane().setBackground(SystemColor.control);
frame.setTitle("MFB");
frame.setBounds(100, 100, 366, 564);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.getContentPane().setLayout(null);
JButton btnStop... |
9d808205-f9d5-4ee5-8e1b-fb35cc9c9255 | 8 | public void definePerBal(int sem) {
String grandTotal = Integer.toString(0);
DataBase.sem_SWPerBal_data[sem][DataBase.schoolGradeCount][DataBase.sem_SWPerBal_data[sem][0].length - 1] = Integer
.toString(0);
for (int colNum = 0; colNum < sem_SWPerBal_headers[sem].length; colNum++) {// Iterates
// through ev... |
38bc2b97-7d99-4824-84b6-dcbf9130a667 | 6 | public void registerCustomer(String cid, String cname, String cadd, String password, String cphone) throws Exception{
con = ConnectionService.getConnection();
try {
PreparedStatement ps = con.prepareStatement("INSERT INTO customer VALUES (?,?,?,?,?)");
if (cid.length() == 0)
{
cid = null... |
a6933309-9620-4d3e-87c3-6a4843866c35 | 3 | public double dameGananciaMedia(Nodo n) {
int ganancia = 0;
int num = 0;
for (Nodo ady : memoria.getAdjacents(n)) {
if (!ady.isEstimacion()) {
ganancia += ady.ganancia;
num++;
}
}
if (num != 0) {
return ganancia / num;
}
return 0;
} |
d669ae76-f2e5-4759-a4b3-46929c307de2 | 4 | private Method findMethod(String beanName, Class type, String methodName, MethodParameter[] parameters) {
Method[] declaredMethods = type.getDeclaredMethods();
for (Method declaredMethod : declaredMethods) {
if (methodName.equals(declaredMethod.getName())) {
if (declaredMetho... |
d9abf6ed-68b1-4bd0-b34d-e8d7cec7d8f8 | 7 | public void tick() {
for (int i=0; i<this.chunkLoadPerTick; i++) {
if (this.requests.isEmpty()) break;
ChunkAddress req = this.requests.poll();
EntityChunk chunk = search(req);
if (chunk == null) {
chunk = loadChunk(req);
}
if (chunk != null)
OpenCraftServer.instance().getWorldManager().getW... |
ee0dce91-e334-4391-8bc1-a8b409b6000d | 5 | public static boolean itemHasEnchantment(ItemStack item, String enchantmentName) {
ItemMeta meta = item.getItemMeta();
if (meta == null) return false;
if (!meta.hasLore()) return false;
for (String lore : meta.getLore()) {
if ((lore.contains(enchantmentName)) && (ENameParser.... |
8f768cdf-d593-4e8b-bff5-f5ed454dba94 | 3 | private void CheckButtons(ActionEvent evt)
{
int num = bRowNum * bColNum;
if(isOdd)
num--;
//System.out.println(evt.getActionCommand());
for(int i = 0; i <num; i++)
{
if(objectButtons[i].getActionCommand().equals(evt.getActionCommand()))
{
drwpnl.SetTexture(i);
mainPanel.setFocusable(true);
... |
abf3ca44-d78a-4562-8e95-b7b4669a9167 | 2 | public void _send(DataLine rq, Object callback) {
rq.set("msgid", self._msgId);
rq.set("clientid", self.clientId);
rq.set("userid", self.userid);
rq.set("userauth", self.auth);
String msg = rq.toString();
if (debug) {
System.out.println("< " + rq.toString());
}
this.ws.send("~m~" + msg.length() + "~... |
598cb57e-5502-47f4-aac4-cd8103890f65 | 3 | public static void main(String[] args) {
// list of fibonnaci numbers calculated so far
ArrayList<BigInteger> fibs = new ArrayList<BigInteger>();
// want a one based array, first two values are one
fibs.add(BigInteger.ZERO);
fibs.add(BigInteger.ONE);
fibs.ad... |
1d9b087e-843c-4171-a83f-0c534a44083c | 3 | public void updateUI() {
super.updateUI();
setFont(Font.decode("Dialog Plain 11"));
if (weekPanel != null) {
weekPanel.updateUI();
}
if (initialized) {
if ("Windows".equals(UIManager.getLookAndFeel().getID())) {
setDayBordersVisible(false)... |
ea09a494-b5d2-4050-8f52-9d05499d739b | 6 | public void copyDataTo(String playername) {
try {
if(!playername.equalsIgnoreCase(this.player)) {
Player to = Bukkit.getPlayerExact(playername);
Player from = Bukkit.getPlayerExact(this.player);
if(from != null) {
from.saveData();
}
Files.copy(this.file, new F... |
c7d408fd-7dca-4c58-a745-a7159b4b9207 | 9 | public void multiSpellEffect(int playerId, int damage) {
switch(c.MAGIC_SPELLS[c.oldSpellId][0]) {
case 13011:
case 13023:
if(System.currentTimeMillis() - Server.playerHandler.players[playerId].reduceStat > 35000) {
Server.playerHandler.players[playerId].reduceStat = System.currentTimeMillis();
... |
39236c39-756b-4fd9-b51f-d449c84e776d | 5 | public static int getIntBE(final byte[] array, final int index, final int size) {
switch (size) {
case 0:
return 0;
case 1:
return Bytes.getInt1(array, index);
case 2:
return Bytes.getInt2BE(array, index);
case 3:
return Bytes.getInt3BE(array, index);
case 4:
return Bytes.getInt4BE(... |
83bd796a-3bf9-4f59-adf5-60444c8a011d | 3 | private int getDistance(Vertex node, Vertex target) {
for (Edge edge : edges) {
if (edge.getSource().equals(node)
&& edge.getDestination().equals(target)) {
return edge.getWeight();
}
}
throw new RuntimeException("Should not happen");
} |
00c56a4e-51e1-421e-9852-ac89e4690219 | 1 | public void writeCompleteConstant(CycConstant cycConstant)
throws IOException {
if (trace == API_TRACE_DETAILED) {
Log.current.println("writeCompleteConstant = " + cycConstant.toString());
}
write(CFASL_EXTERNALIZATION);
write(CFASL_COMPLETE_CONSTANT);
writeGuid(cycConsta... |
0db8686f-a3dd-42ab-99f5-09fed8bdac56 | 8 | public Activity[] list () {
Connection con = null;
PreparedStatement statement = null;
ResultSet rs = null;
List<Activity> activities = new ArrayList<Activity>();
try {
con = ConnectionManager.getConnection();
String searchQuery = "SELECT * FROM activities";
statement = con.prepareS... |
b9de0b52-46e3-4c01-8aee-641c46f0733d | 4 | public void setupVaultPermissions() {
if (!hasVaultPlugin() || !manager.isPluginEnabled("Vault") || permHook != null) {
return;
}
RegisteredServiceProvider<Permission> rsp = plugin.getServer().getServicesManager().getRegistration(Permission.class);
if (rsp != null) {
permHook = rsp.getProvider();
plugi... |
3131eb2f-2ddf-47aa-a816-687cfaae0249 | 2 | private IPlanTicketFilter[] createFilters() throws Exception
{
ServiceContainer site = new ServiceContainer();
site.initializeServices(this.getSite(), new Object[]{this});
IPlanTicketFilter[] rs = new IPlanTicketFilter[_filterTypes.length];
for(int i = 0; i < _filterTypes.length; i ++)
{
rs... |
09ad0105-913f-4577-89da-a9e05a22f03b | 2 | public void add(Node n) {
// Valeur à ajouter
LinkSimpleNode newValue = new LinkSimpleNode();
newValue.setNode(n);
newValue.setNext(null);
if (linkSimple == null) {
linkSimple = newValue;
} else {
LinkSimpleNode actual = linkSimple;
while (actual.getNext() != null) {
actual = (LinkSimple... |
fbeaf103-cda4-4a1f-9f3c-0456e6dea229 | 1 | private void gameRender() {
// clear back buffer...
g2d = bi.createGraphics();
g2d.setColor( background );
g2d.fillRect( 0, 0, WIDTH - 1, HEIGHT - 1 );
/*==================================================================
* GAME RENDERING METHODS
*======================================================... |
9c2eb518-6db0-4138-a0bf-944505591fa5 | 4 | public static Method getStaticMethod(Class<?> clazz, String methodName,
Class<?>... args) {
Assert.notNull(clazz, "Class must not be null");
Assert.notNull(methodName, "Method name must not be null");
try {
Method method = clazz.getMethod(methodName, args);
return Modifier.isStatic(method.getModifiers())... |
37737268-7617-4350-b7e7-af07de080b33 | 6 | @SuppressWarnings("unused")
public String execute() {
String returnVal = SUCCESS;
if (getSubmit() != null && SUBMIT.equals(getSubmit())) {
validate();
LibraryManagementFacade libraryManagementFacade = new LibraryManagementFacade();
try {
UserVO validUserVO = libraryManagementFacade
.authenticate... |
bbada1f6-2dd8-467a-847c-f80e24a35c72 | 9 | private void tressMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_tressMouseClicked
// TODO add your handling code here:
try {
if (conexion == true && enviando == 0) {
enviando = 1;
int opciones;
if (esinicio != 0 && 3 <= esini... |
8bce08ad-ca27-40e3-a7ca-d2e7be454357 | 4 | public static void insertEvents (EventsBean event){
PreparedStatement pst = null;
Connection conn=null;
boolean result = false;
try {
conn=ConnectionPool.getConnectionFromPool();
pst = conn
.prepareStatement("INSERT INTO EVENTS (NAME, DESCRIPTION, EVENT_DATE, VENUE, TOTAL_SEATS, BOOKED_SEATS, T... |
9a7506ed-a514-4af4-8394-eb820e2fed49 | 6 | public static String find(String line) {
line = StringUtility.removeNewLine(line);
if (line.contains("דרך תצורה=|נטיות=}")) {
return "";
}
if (line.contains("דרך תצורה=")) {
String[] arr = line.split("\\|נטיות=");
if (arr.length > 1) {
... |
1b7a0946-db4b-4bd0-8104-29674e3c6d0b | 0 | public String getNum() {
return num;
} |
f7fd5d4c-3e77-4286-aef7-3ecc682e2850 | 1 | public static String StringtoDate(String timestamp){
try {
SimpleDateFormat sdfToDate = new SimpleDateFormat(
"yyyy-MM-dd HH:mm:ss.SSS");
Date date = sdfToDate.parse(timestamp);
SimpleDateFormat sdfTranslated = new SimpleDateFormat(
... |
1948d675-e6dd-48ee-9477-46b58f679662 | 4 | public int compareTo(Object o){
if(!(o instanceof ByteArray)) return this.toString().compareTo(o.toString());
int thisbound=bytes.length;
ByteArray cmp=(ByteArray)o;
int obound=cmp.bytes.length;
int bound=thisbound>obound?obound:thisbound;
for(int i=0;i<bound;i++){
if(bytes[i]==cmp.bytes[i... |
441126c4-6b54-47e0-8ee5-feb018547419 | 1 | @Override
public int attack(double agility, double luck) {
if(random.nextInt(100) < luck)
{
System.out.println("I just crashed a bunch of magic at the enemy, Yo!");
return random.nextInt((int) agility) * 3;
}
return 0;
} |
477bf931-8c7e-42aa-a252-6a3770827ccb | 4 | private boolean read() {
try {
final URLConnection conn = this.url.openConnection();
conn.setConnectTimeout(5000);
if (this.apiKey != null) {
conn.addRequestProperty("X-API-Key", this.apiKey);
}
conn.addRequestProperty("User-Agent", Up... |
95789fb2-3922-448c-88d3-88d2e013bf89 | 6 | private static void keyCreation() {
boolean kc_loop = true; // makes sure key creation loops
do {
System.out.println("\n\n\n+==+ KEY CREATION +==+ \n\n"+
"-- 1 - Create public & private keys -- \n"+
"-- 2 - Change prime numbers' bit length (current: "+length+" bits) -- \n"+
"-- 3 - Go back ... |
f60ea29b-e75e-4f62-8946-8b3a36906789 | 5 | public String toXMLString() {
// %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
// Implement this method. Hint: You will need to do a
// combination of pre-Order and post-Order. That is, at each
// level you will need to call the label's "preString()"
// method before any recursive calls and then c... |
dcc7f86a-e7c3-4349-8351-6be4a815f352 | 0 | public BehaviourType decideBehaviourType(Stats s) {
return BehaviourType.CARNIVORE;
} |
b13b0446-f8ac-4fa5-941b-c1ef2462d84d | 5 | private void reheapify() {
E root = array.get(1);
int lastIndex = array.size() - 1;
int index = 1;
boolean more = true;
while (more) {
int childIndex = getLeftChildIndex(index);
if (childIndex <= lastIndex) {
E child = getLeftChild(index);
// Use right child instead if it is smaller.
if (... |
805f6382-cf6f-4a18-a296-c40b31cf1d0b | 0 | @Bean
public DataSource dataSource() {
BasicDataSource ds = new org.apache.commons.dbcp.BasicDataSource();
ds.setDriverClassName("org.apache.derby.jdbc.ClientDriver");
ds.setUrl("jdbc:derby://localhost:1527/sample");
ds.setUsername("app");
ds.setPassword("app");
retur... |
0d841f0a-69af-4aed-8801-650c2242379e | 6 | public void click(int column, int row) {
if (!selected) {
if (pieces[column][row] != null && pieces[column][row].getColor() == activePlayer) {
selected = true;
selectedColumn = column;
selectedRow = row;
possibleMoves.addAll(pieces[colu... |
164e984a-dadd-46c6-bf05-5898d318b7d5 | 6 | public Boundsheet getFirstSheet()
{
if( parent_rec != null )
{
WorkBook wb = parent_rec.getWorkBook();
if( sheetname != null )
{
try
{
return wb.getWorkSheetByName( sheetname );
}
catch( WorkSheetNotFoundException e )
{
; // fall thru -- see sheet copy operations -- appear... |
62c86cff-5b23-4b06-a606-afa087f76519 | 3 | protected TableModel createModel(Transition transition) {
final TMTransition t = (TMTransition) transition;
return new AbstractTableModel() {
public Object getValueAt(int row, int column) {
return s[row][column];
}
public void setValueAt(Object o, int r, int c) {
s[r][c] = (String) o;
}
pub... |
b5d1fc6c-9456-411f-b683-2a06335942b4 | 5 | @Override
public DataTable generateDataTable (Query query, HttpServletRequest request) throws DataSourceException
{
DataTable dataTable = null;
try (final Reader reader = new FilterCsv (new BufferedReader (new InputStreamReader (new URL (this.urlYahoo).openStream()))))
{
TableRow row = new TableRow ();
... |
6526a7ff-1835-448c-8d21-45a28254b75e | 3 | private void setFieldsForEditing() {
subjectTextField.setText(this.proposal.getSubject());
descriptionTextField.setText(this.proposal.getDescription());
String options = "";
for (Iterator<String> it = this.proposal.getOptions().iterator(); it.hasNext();) {
String o = it.next(... |
f86cac63-8ec0-4a21-8fa5-8b78e6f27843 | 8 | public static boolean isRightButton(MouseEvent e, Boolean ctrlDown, Boolean shiftDown, Boolean altDown)
{
return (e.getModifiersEx() & MouseEvent.BUTTON1_DOWN_MASK) == 0 &&
(e.getModifiersEx() & MouseEvent.BUTTON2_DOWN_MASK) == 0 &&
(e.getModifiersEx() & MouseEvent.BUTTON3_DO... |
9d224a14-b198-4964-b19f-c432ebe5bcb3 | 3 | public int mfiLookback( int optInTimePeriod )
{
if( (int)optInTimePeriod == ( Integer.MIN_VALUE ) )
optInTimePeriod = 14;
else if( ((int)optInTimePeriod < 2) || ((int)optInTimePeriod > 100000) )
return -1;
return optInTimePeriod + (this.unstablePeriod[FuncUnstId.Mfi.ordinal()]) ;
... |
5cb2ee32-dd81-4731-bb1e-2c5f9c02599b | 8 | private void split(DoublyLinkedNode curr, int red, int green, int blue,
int previousRunLength, int nextRunLength) {
DoublyLinkedNode previousRun, nextRun;
previousRun = previousRunLength <= 0 ? curr.getPrevious() : new DoublyLinkedNode(new Run((int) curr.getValue().getRed(), (int) curr.getValue().getGreen(), (in... |
a8b53603-ed01-46eb-bf5a-f349be3c9271 | 5 | public void checkRutor()
{
for(int i = 0;i < rutor.length && rutor[i] != null;i++)
{
if(rutor[i].inside(BoJMouseListener.getX(),BoJMouseListener.getY()))
{
rutor[i].increaseAntalTryck();
}
}
if(BoJMouseListener.getX() != BoJMouseLis... |
f8d542e6-9751-48a5-9020-2f0f9349adb9 | 7 | @Override
public boolean execute(CommandSender par1Sender, Command par2Command,
String par3Args, String[] par4Args) {
int page;
try {
page = Integer.parseInt(par4Args.length > 0 ? par4Args[0] : "0") * 10;
} catch (NumberFormatException e) {
page = 0;
}
ArgsParser ap = new ArgsParser();
ParseComman... |
2af44774-11fa-4baf-bad0-b02d98926bbd | 0 | public int getMinimum() {return bar.getMinimum();} |
bec05919-78d4-4587-8b97-d408addb8b34 | 5 | public void keyPressed(KeyEvent e)
{
int key = e.getKeyCode();
if (key == KeyEvent.VK_LEFT)
{
Magnus.moveDirection = 2;
Magnus.dx = -1;
System.out.println("Left key pressed");
}
if (key == KeyEvent.VK_RIGHT)
{
... |
8e5a0bb4-ad9b-40ea-880a-335e53c6113e | 0 | private void initButtonBar(){
menuBarWithButtons = new JToolBar();
menuBarWithButtons.setSize(this.getWidth(), MENU_BAR_WITH_BUTTONS_HEIGHT);
menuBarWithButtons.setBorderPainted(true);
menuBarWithButtons.setBorder(BorderFactory.createLineBorder(Color.gray, 1));
JToggleButton ... |
475ed9d1-541b-4bd0-87f4-ed13c43a74b4 | 9 | private String readString() throws JSONException {
Kim kim;
int from = 0;
int thru = 0;
int previousFrom = none;
int previousThru = 0;
if (bit()) {
return getAndTick(this.stringkeep, this.bitreader).toString();
}
byte[] bytes = new byte[65536];... |
ce331a48-e87a-44b8-8a12-9a6ca1820a7a | 7 | public static boolean[] nextPosition(boolean switches[], int numTrue){
String value = "";
boolean retSwitches[] = new boolean [switches.length];
for(int i = 0; i < switches.length; i++){
value += switches[i] == true ? 1 : 0;
}
value = value.replaceAll( "[^\\d]", "" );
int currentValue = Integer.pars... |
1d231bb2-b960-410c-b52c-09e0241db667 | 0 | public ZipUnpacker(String inputZip)
{
this.inputZip=inputZip;
outputFolder="temp";
} |
9b775ab2-2f5a-42ea-b9a6-6cabadb3ce84 | 7 | public void exploreDirectory(File f,String path, int linesNumber) {
//one file object is created with the directory path
File directory =new File(path);
BufferedWriter bw = null;
//Check if the path exists
if (!directory.exists()) {
System.out.println("The path " + directory.getAbsolutePath() + " does n... |
ccd6c4d9-82e3-44b4-96e6-81cff9145af2 | 4 | public String readBinary(Key key, String valueName) throws RegistryErrorException
{
if(key == null)
throw new NullPointerException("Registry key cannot be null");
if(valueName == null)
throw new NullPointerException("Valuename cannot be null, because the default value is always a STRING! If you wa... |
5b6b2b70-4c54-4ce9-896a-307aae531392 | 5 | private String[] getCustomFilterNodeValue(final Document doc) {
List<String> values = new ArrayList<>();
Node filterNode = this.getFirstLevelNodeByTag(doc, FILTER_TAG);
if (filterNode == null) {
return null;
}
Node customFilterNode = this.getNodeByTagInNode(filterNode, CUSTOM_TAG);
if (customFilterNode =... |
3db66ebd-cbbf-474a-9316-7c6ddcb9e1df | 6 | private void Drink()
{
thirst = ps.getThirst();
waterAmount = ps.getWaterCollected();
waterLimit = ps.getWaterLimit();
hasSolarUpgrade = ps.getHasSolarUpgrade();
if (!hasSolar)
{
Dialog.message("I don't have a source of water to consume!"... |
f859dd5b-d60f-42ee-a028-6871dd83fb86 | 2 | public static void showCannotOpenMsg(Component comp, String name, Throwable throwable) {
if (throwable instanceof NewerDataFileVersionException) {
WindowUtils.showError(comp, MessageFormat.format(UNABLE_TO_OPEN_WITH_EXCEPTION, name, throwable.getMessage()));
} else {
if (throwable != null) {
Log.error(thr... |
eb06a222-1df3-4066-9e0b-16dae2319661 | 7 | @Override
public boolean perform(final Context context) {
// Example: /<command> timezone[ get][ <Player>]
int position = 2;
if (context.arguments.size() >= 2 && !context.arguments.get(1).equalsIgnoreCase(this.name)) position = 1;
OfflinePlayer target = Parser.parsePlayer(context, po... |
c018b8ab-8284-4e2d-8814-d6abf78cd601 | 8 | private HashMap<ArrayList<Integer>, Integer> parseInputFile(String inputFile) {
try {
HashMap<ArrayList<Integer>, Integer> data = new HashMap<ArrayList<Integer>, Integer>();
// read file input
BufferedReader in = new BufferedReader (new FileReader(inputFile));
// read the first line to initialize ... |
b7bad03f-8d66-495d-aabd-585571a9c2ce | 9 | public void handleLogin(){
User u = loginView.getModel();
// Check if username is empty, if so then show a message.
if (u.getUsername().isEmpty()) {
JOptionPane
.showMessageDialog(
null,
"U moet een gebruikersnaam invoeren om in te kunnen loggen.",
"Fout!", JOptionPane.ERROR_MESSAGE);... |
8858e47d-47ae-4a26-ba1a-7ac99876b003 | 3 | public ClientThread(int id, CyclicBarrier barrier) {
this.id = id;
// determine where to push/pull info:
if(id == 0) {
req = new int[1];
req[0] = 1;
res = new int[1];
res[0] = 0;
} else if(id == 1) {
... |
656731dd-1a86-4041-ae90-304ecf87a6be | 5 | public Node getPayloadNode() throws Exception {
Node result = null;
Node payloadNode = Utilities.selectSingleNode(this.getDocument(), "/dc:DCTransaction/*/dc:Payload", XMLLabels.STANDARD_NAMESPACES);
if(payloadNode != null) {
Node first = payloadNode.getFirstChild();
if(first != null) {
switch(first.... |
b936be82-f49c-4a54-acc3-cedceb2fe1dc | 7 | private void renderEntities()
{
for(Entity ent: entities)
{
if(ent==null)
continue;
ent.render();
int[] pix = ent.getPixels();
for(int x = 0; x < ent.getImageWidth(); x++)
{
for(int y = 0; y < ent.getImageHeight(); y++)
{
int yy = (((y + ent.getLocation().getY()) - yOffset) - ((ent.... |
88ac5c11-8012-4270-920d-859bc4c3e389 | 3 | @Override
public void run() {
Player[] players = plugin.getServer().getOnlinePlayers();
Player player;
long MarkerTime = System.currentTimeMillis() - (plugin.getConfig().getInt("AFK_TIMER") * 60 * 1000);
for (int i = 0; (players.length - 1) >= i; i++) {
long afkTime = 0;
player = players[i];
UserTable... |
51fee026-53d9-4857-91e2-c6e2fa8d3000 | 7 | void writeData(short fid, short file_offset, byte[] data,
short data_offset, short length) {
byte[] file = getFile(fid);
short fileSize = getFileSize(fid);
if (file == null) {
ISOException.throwIt(ISO7816.SW_FILE_NOT_FOUND);
}
if (fileSize < (short) (fil... |
a53fd446-ee9c-4eb6-8315-23e69690b154 | 2 | public String getMusic(String scene) {
if(scene.equalsIgnoreCase("main menu")) {
return "assets/audio/testi.wav";
}
if(scene.equalsIgnoreCase("gameplay")) {
return "assets/audio/background.wav";
}
return null;
} |
07491b51-c6a4-4a6d-9c9c-f690e1891fda | 9 | public boolean keyDown(Event e, int key)
{
if (key == Event.LEFT)
{
player.setDirection(Player.LEFT);
player.setFacing(Player.LEFT);
}
if (key == Event.RIGHT)
{
player.setDirection(Player.RIGHT);
player.setFacing(Player.RIGHT);
}
if (key == Event.UP)
{
player.setDirection(Player.UP);... |
5d1656f0-5304-4ddc-bc46-51443b26ff5a | 5 | @Override
public SecurityChallenge getUserSecurityChallenge(String username) {
for(LdapServer server : ldapServers) {
try {
SecurityChallenge challenge = server.getUserSecurityChallenge(username);
if(logger.isDebugEnabled()) {
if(challenge != null) {
logger.debug("Successfully got security c... |
f0ee68df-15cc-464b-9f4a-393fba7fc5ae | 0 | public String toString() {
return "waiting for items to be chosen";
} |
d0145d2c-5ded-4881-be60-62e5151450f7 | 9 | public static String find(File file) {
RandomAccessFile fileHandler = null;
try {
fileHandler = new RandomAccessFile(file, "r");
long fileLength = fileHandler.length() - 1;
StringBuilder sb = new StringBuilder();
for (long filePointer = fileLength; filePoi... |
cb9e7d61-d13d-4bfc-be9f-ba08fb550b35 | 7 | @Override
public void execute() {
boolean partyFull = curGb.readMemory(curGb.pokemon.numPartyMonAddress) >= 6;
seq(new EflSkipTextsSegment(1)); // wild mon
seq(new EflBallSuccessSegment());
seq(new EflSkipTextsSegment(4)); // cought, new dex data
seqEflButton(Move.A); // skip dex
seqEflButton(Move.B... |
4c11973f-25f3-47c0-b2de-73a2edd89000 | 6 | @Override
public boolean removeAll(Collection<?> c) {
if (c == null || c.isEmpty()) {
return false;
}
boolean removedAll = true;
for (Object element : c) {
if (element == null) {
removedAll = false;
}
}
return remove... |
6e760b6c-6129-4710-a2b5-b22f4b419b63 | 8 | private int searchIndex(int numero, boolean activa){
int index = -1;
if(activa){
for (int i = 0; i<cuentas.length; i++) {
if(cuentas[i] != null && cuentas[i].validarCuenta(numero) && cuentas[i].isActiva()){
index=i;
break;
... |
1be19eb7-4818-4614-82d2-37e832011300 | 6 | public static void main(String args[]) {
/*
* Set the Nimbus look and feel
*/
//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
/*
* If Nimbus (introduced in Java SE 6) is not available, stay with the
* default look and fe... |
11808801-5a67-43e3-adf7-73c46b95db1f | 7 | private static boolean isSimpleReturnType(Method method, Object object) {
Class<?> returnType = getActualReturnType(method, object);
return returnType.equals(Integer.TYPE) || returnType.equals(Integer.class) || returnType.equals(Double.TYPE)
|| returnType.equals(Double.class)
... |
47668ca9-da6b-42b7-a6ff-9cf11fd80cb6 | 7 | public void setValueAt(Object o, int row, int col) {
if (row != newRow) {
if (col == 1 || o.toString().length() > 0) {
int rowInModel = row < newRow ? row : row - 1;
nodeAttributeModel.setValueAt(o, rowInModel, col);
}
return;
} else {
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.