method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
b64608eb-edb4-4cdf-afbd-f87d40f2ae7d | 3 | public int getIndex(String opCode) {
for (int i = 0; i < size; i++) {
if (tuples[i].getValue() != null) {
if (tuples[i].getValue().equals(opCode)) {
return i;
}
}
}
return -1;
} |
2b0a1a31-d1b1-45a3-a61d-c16def28518d | 1 | private void writeArray(List<Byte> ret, Object[] val) throws EncodingException, NotImplementedException
{
writeInt(ret, (val.length << 1) | 1);
ret.add((byte)0x01);
for (Object obj : val)
encode(ret, obj);
} |
ecc66f29-7d11-44ee-9f10-af743bf041f6 | 9 | private boolean r_combo_suffix() {
int among_var;
int v_1;
// test, line 91
v_1 = limit - cursor;
// (, line 91
// [, line 92
ket = cursor;
// substring, line 92
... |
f3f1aa7d-b289-4384-b0c2-5354a87f4d98 | 1 | public static void main(String[] args) {
ExecutorService exec = Executors.newCachedThreadPool();
for (int i = 0; i < 5; i++)
exec.execute(new LiftOff());
exec.shutdown();
System.out.println("Waiting for LiftOff");
} |
504ff53b-2bf2-4ddc-b70a-a6f8b099e586 | 5 | private void init()
{
this.clock.add(DAWN);
for(int i = 0; i < MAX_CLOCK_SIZE-1; i++)
{
this.clock.add(NIGHT);
}
this.shuffle(this.clock);
for(int i = 0; i < 5; i++)
{
this.library.add(NIGHT);
}
for(int i = 0; i < 18; i++)
{
this.library.add(RUMOR);
}
for(int i = 0; i < 15; i+... |
9f193655-7961-4e1e-9a8c-60651e211814 | 2 | public static boolean sleepClauseActive(Pokemon[] p, int pokemonAvailable)
{
for(int i=0; i<pokemonAvailable; i++)
{
if(p[i].status==Pokemon.Status.SLP)
return true;
}
return false;
} |
ca8bee63-2270-4592-9696-779683113279 | 8 | @Override
public boolean numericalCheck() {
//
// over all time steps.
//
for (int f = 0; f < this.data.framewidth; f++) {
//
// for all cells.
//
for (int j = 0; j < this.structure.cellsnum; j++) {
if (!check(this.data.... |
7cec76c9-d02d-4cb2-a63d-447a2cc0cb61 | 2 | public boolean updatePosListaPrecioCeroA(final PosListaPrecio itemOracle){
Session hbSessionOracle = getSession(); // SESSION MYSQL
Transaction tsOracle = hbSessionOracle.beginTransaction();
boolean successOracle = false;
try {
getHibernateTemplate().execute(new HibernateCallback() {
@Override
... |
a2ad71fc-15da-454e-a489-942c187c649a | 2 | private void OpenButtonDialogActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_OpenButtonDialogActionPerformed
this.OpenDialog.setVisible(false);
try {
System.out.println(this.FileChooser.getSelectedFile().getName());
String name = StringTools.getNameWithoutExten... |
86a1fe1b-7523-41f5-a8e7-390b2cbab7bd | 8 | public void callFunc(final int startIndex, final int endIndex, MInteger outBegIdx, MInteger outNbElement)
throws IllegalArgumentException, IllegalAccessException, InvocationTargetException {
int count = 0;
for (Object item : callInputParams) {
if (PriceInputParameter.class.isAs... |
cbd89857-c477-438b-a74d-91af3d7f231d | 1 | private DateTime getADate(String s) {
DateTime retDT = null;
try {
retDT = new DateTime(s, DateTimeZone.UTC);
} catch (IllegalArgumentException pe) {
pe.printStackTrace();
}
return retDT;
} |
2516fe70-2717-44f8-a96a-cb3853fad641 | 4 | private void moveTo(Point point) {
Point nextLocation = getLocation();
if (point.x > nextLocation.x) {
nextLocation.x++;
}
if (point.x < nextLocation.x) {
nextLocation.x--;
}
if (point.y > nextLocation.y) {
nextLocation.y++;
}
if (point.y < nextLocation.y) {
next... |
31c850cf-c0ba-46a8-94fc-549d32cdef0f | 7 | @Override
public void run()
{
double distance = Math.abs((endPoint - startPoint) / numberOfProbes);
double[] evaluationPoints = getEvaluationPoints(startPoint, distance, numberOfProbes);
List<Double> startingPointsToCheck = findRangesWhereSignsChange(f, evaluationPoints, numberOfProbes);
/*
* For eac... |
41d1dcf9-6fae-4b68-b7b0-1d77c04c95a9 | 0 | public void setId(Integer id) {
this.id = id;
} |
40df4489-b082-40ae-be0b-ca6e4623cc9d | 8 | public Decision decide(RobotView controlledRobot, RobotEnvironmentView environmentView) {
// okreslamy czy robot ma cos w kieszeni
if (controlledRobot.getCache().isEmpty()) {
// kieszen jest pusta
logger.level2("Kieszen pusta");
// sprawdzamy czyjakis student czegos nie potrzebuje
// przegladamy wsz... |
21a1dead-082e-4f15-938f-2bd787ee37d2 | 2 | @Override
public void run()
{
while(!end)
{
try
{
Thread.sleep(10);
}
catch (InterruptedException e) {}
repaint();
}
} |
c7608d08-b445-4cfe-9bc9-e24961291f85 | 1 | private boolean jj_3_40() {
if (jj_3R_59()) return true;
return false;
} |
40c0dab8-4e11-4b98-b38a-4535a4b0dacb | 1 | public boolean correctCombination(AnswerCombination answerCombination) {
if (answerCombination.getBlackCount() == 5) {
return true;
}
else {
return false;
}
} |
5dee134f-69b5-4808-934b-3f75dcf4dc85 | 4 | @Override
public String onKill(L2Npc npc, L2PcInstance killer, boolean isPet)
{
switch (npc.getNpcId())
{
case Lilith:
if (getQuestTimer("spawn_exitgk_lilith", null, null) == null)
startQuestTimer("spawn_exitgk_lilith", 10000, null, null, 0);
break;
case Anakim:
if (getQuestTimer("spawn... |
3e060547-9bac-408c-84ce-96db93badd36 | 2 | private Set<String> placeFigureAtPositionOnBoard(char figure, int position, String board) {
int dimension = (int) Math.sqrt(board.length()) + 1;
isBoardLegal(board, dimension);
Set<String> setOfPossibleBoards = new HashSet<>((int) IntStream
... |
21d1fea1-6759-4994-a4cf-2aded5f72402 | 7 | public void expandNode(final Node n) {
new Thread() {
@Override
public void run() {
synchronized (LocalityUtils.this) {
if (!locality.getCompleteEltSet().contains(n))
return;
manager.stopDamper();
for (int i = 0; i < n.edgeCount(); i++) {
Node newNode = n.edgeAt(i).getOtherEndpt(n... |
9994a668-76a3-450f-8bdf-1558cee37f69 | 6 | public void updateRaws(String cookieName) {
ArrayList<String> materials = getIng(cookieName);
for (int i = 0; i < materials.size(); i++) {
ResultSet rs1 = null;
ResultSet rs2 = null;
String materialType = materials.get(i);
int amountInStock = 0;
int amountNeeded = 0;
String sql1 = "select amountNe... |
69d9a4d1-af0c-43e6-98b0-90c7fec89765 | 3 | public static Mascota crearMascota(int tipo, String nombre){
Mascota mascota = null;
if(tipo == 1){
mascota = new Perro(nombre);
}else if(tipo == 2){
mascota = new Gato(nombre);
}else if(tipo == 3){
mascota = new Ave();
}
... |
2f7be435-f408-4099-a9b6-287fe0953e0e | 2 | private int getVillagerCount() {
int count = 0;
for (Player player : players.getPlayers()) {
if (player.getRole().equals(Role.Villager.toString())) count++;
}
return count;
} |
989391e3-bf25-4700-afe3-a11290e35640 | 5 | public void putField(Reference ref, Object obj, Object value)
throws InterpreterException {
Field f;
try {
Class clazz = TypeSignature.getClass(ref.getClazz());
try {
f = clazz.getField(ref.getName());
} catch (NoSuchFieldException ex) {
f = clazz.getDeclaredField(ref.getName());
}
} catch ... |
64de1ed0-c557-4ad9-946b-0f8aa5f885ee | 9 | private void parseDocument() {
// get the root elememt
Element docEle = dom.getDocumentElement();
// get a nodelist of <employee> elements
NodeList shapeNodeList = docEle.getElementsByTagName("Shape");
if (shapeNodeList != null && shapeNodeList.getLength() > 0) {
for (int i = 0; i < shapeNodeList.getLengt... |
866cdc7e-b328-455a-9def-cb4d2391694c | 2 | private Connection getConnection() {
try {
Class.forName("org.sqlite.JDBC");
} catch (ClassNotFoundException e) {
Utilities.outputError("Could not find sqlite drivers");
return null;
}
try {
return DriverManager.getConnection("jdbc:sqlite:" + m_databaseFile.getAbsolutePath());
} catch (SQLEx... |
9b4dda4b-bbdd-44a8-a349-ced26a1f6c1e | 0 | public void setSerialNo(String value) {
this.serialNo = value;
} |
33223f94-9d81-4bc1-9453-b474a63d23be | 3 | @Override
public void parseArgs(String[] args) {
this.args = args;
int i = 0;
if (args[0].equals("-v")) {
verbose = true;
i++;
}
if ((args.length - i) != 2) usage(null);
numSplits = Gpr.parseIntSafe(args[i++]);
fastqFile = args[i++];
if (numSplits <= 1) usage("Number of splits should be more t... |
98cb11de-0984-4bc3-967c-d890b0cecd99 | 6 | public static void main(String[] args) {
Scanner scan=new Scanner(System.in);
int plots = 24;
int rounds;
int players;
System.out.println("'Welcome to Monopoly Board Game'");
System.out.println();
System.out.print("Please enter number o... |
001ae4b1-d6c5-4134-8d07-08320f61b144 | 4 | public static byte[] readStream(InputStream fin) throws IOException {
byte[][] bufs = new byte[8][];
int bufsize = 4096;
for (int i = 0; i < 8; ++i) {
bufs[i] = new byte[bufsize];
int size = 0;
int len = 0;
do {
len = fin.read(bufs... |
c937b85b-37da-4ccc-a7de-0ccf62d2e88e | 5 | public boolean info(CommandSender sender, String[] args)
{
String name;
if (args.length > 1) { //Player specified a name
name = args[1];
} else {
name = sender.getName();
}
Resident resident = em.find(Resident.class, name);
if (residen... |
2175f7d0-9d3e-4dbc-9ae4-368eeca1d1f8 | 7 | public void run() {
try {
while(s.isConnected() && out != null) {
try {
Thread.sleep(400);
} catch (InterruptedException e) {}
out.flush();
out.reset();
System.out.println("Sent an update!");
... |
542472f7-d414-4b17-aed4-95fcc1d87f98 | 2 | public static TrafficStatusEnum fromValue(String v) {
for (TrafficStatusEnum c: TrafficStatusEnum.values()) {
if (c.value.equals(v)) {
return c;
}
}
throw new IllegalArgumentException(v);
} |
51493fa4-7a10-4ccf-96ef-611ce5c50caf | 7 | public String execute() {
Map<String, Object> session = ActionContext.getContext().getSession();
User user = (User) session.get("USER");
list = null;
String actionResult = "";
reportBusinesService = new ReportBusinesService();
log.info(user.getFname() + startDate + end... |
6f6e9879-0848-4bad-9a05-823db9002ca3 | 3 | public void kaynnista() {
while (true) {
System.out.print("Anna lauseke (tyhja lopettaa): ");
String syote = lukija.nextLine();
if (syote.equals("")) {
break;
}
try {
MerkkijononKasitte... |
058b781d-fb27-46b1-8a09-1cb032d03ab9 | 3 | @Override
public void update(Observable o, Object arg) {
if(this.model.getCurrentPlayer() == this.player &&
this.model.getGameState() == GameState.DURING) {
ArrayList<Piece> validMoves = this.model.getBoard()
.getValidMoves(this.player.getColor());
if(validMoves.size() > 0) {... |
6a7da203-2361-43aa-a989-5e7b5719ea51 | 4 | private void submitExpression(boolean showErrors) {
Expression.setEnteredExpression(expression.getText());
if (expression.getText().equals("")) {
makeTableDisplay();
} else {
try {
if (Expression.validate()) {
makeTableDisplay();
}
} catch (ValidationException ex) {
// if the function ca... |
65bea47d-f509-468e-87b1-9d0da428a1b7 | 4 | public void setRepita(List<?> list)
{
for(PComando e : this._repita_)
{
e.parent(null);
}
this._repita_.clear();
for(Object obj_e : list)
{
PComando e = (PComando) obj_e;
if(e.parent() != null)
{
e.paren... |
017fe4d4-605a-44dd-9835-af6ad268fd10 | 9 | public void doStep() {
anz = 0;
for (int i = 0; i < size; i++) {
for (int j = 0; j < size; j++) {
newCells[i][j] = 0;
}
}
for (int i = 0; i < size; i++) {
for (int j = 0; j < size; j++) {
switch (calcNeighborsPeriodic(i, j)) {
case 0:
case 1:
newCells[i][j] = 0; // dies
break;... |
895fedf8-1704-4259-a47f-404b667c67b7 | 3 | public String getValue() {
try {
return readValue();
} catch (FileNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (RuntimeException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
... |
900ae7a4-8ed6-4139-92f0-dc30c808bdff | 2 | public Object[] subarray_as_Object(int start, int end){
if(end>=this.length)throw new IllegalArgumentException("end, " + end + ", is greater than the highest index, " + (this.length-1));
Object[] arrayo= new Object[end-start+1];
for(int i=start; i<=end; i++)arrayo[i-start] = this.array.get(i);
... |
7990be23-39a7-4785-a7f2-59829cfd3ee2 | 4 | public void finjectInpPayload (Circuit c, byte[] info, boolean alice_inputs) {
int i, j, k, line_num, consumed_bytes ;
for (i = k = 0; i < FMT.size(); i++) {
IO io = FMT.elementAt(i);
// Verify it's a relevant i/o object
if (!io.isInput()) continue;
if (... |
12450061-f959-4936-934a-d854bcb296f3 | 2 | public void print(){
for (int i = 0; i < FIELD_SIZE; i++){
for (int j = 0; j < FIELD_SIZE; j++){
System.out.print(points[i][j].getLetter() + " ");
}
System.out.println("");
}
} |
806e197a-50f6-4a75-a6e3-6573546f5840 | 9 | private synchronized HttpClient getHttpClient() {
if (client == null) {
// #ifdef DEBUG
log.info("Creating HttpClient instance"); //$NON-NLS-1$
// #endif
client = new HttpClient(aditoHostname, aditoPort, isSecure);
client.setAuthenticationPrompt(defaultAuthenticationPrompt != null ? defaultAuthenticati... |
80e7ddc4-199b-4ab9-9ab7-19dda678ff46 | 8 | public void run() //listening
{
Server.print("running function: run()");
boolean isOK = true;
while (isOK)
{
try
{
String in = input.readUTF();
if (in.equals("#move"))//new move
{
int bX = i... |
555df3ff-3bfa-42af-9dfd-de61406e095e | 0 | @Basic
@Column(name = "FUN_USUARIO")
public String getFunUsuario() {
return funUsuario;
} |
8240f323-3f5b-4f50-bd31-b003856fea19 | 1 | public List<String> readCaptionRow() {
List<String> captions = new ArrayList<String>();
HSSFSheet sheet = wb.getSheetAt(0);
Iterator<Row> rowIt = sheet.iterator();
Row row = rowIt.next();
for (Cell cell : row) {
captions.add(cell.getStringCellValue());
}
... |
0f078bf0-f94c-47d9-83fa-b31fdb850067 | 5 | public void registerName (String name) {
// Do nothing if the player already registered a name.
if (this.name != null) return;
// Do nothing if the name is invalid.
if (name == null) return;
name = name.trim();
if (name.length() == 0) return;
// Store the player's name.
this.name = name;
// A... |
6e84d16d-28f1-4eb6-b79e-4b6d7d510439 | 6 | public Construct getParentForBinding(EInterfaceAction binding) {
switch(binding) {
case Bind_InsertAfter:
case Bind_InsertBefore:
case Bind_InsertReplace:
case Bind_DuplicateToAdjacent:
case Bind_InsertPaste:
return parent;
case Bind_InsertChild:
return this;
default:
br... |
a8122ec4-e582-4caf-b3a9-6e5367825905 | 3 | @Override
public void caseAAvalieComando(AAvalieComando node)
{
inAAvalieComando(node);
if(node.getPadrao() != null)
{
node.getPadrao().apply(this);
}
{
List<PCasoOpcao> copy = new ArrayList<PCasoOpcao>(node.getCasoOpcao());
Collections... |
50bfd248-0cff-4caa-b58c-7fe013143573 | 0 | public String toString(){
return typeOf;
} |
0737ce29-ec1b-4992-8442-a6ecd0dceb06 | 8 | public void enterFromRail(Color player, Integer dest) {
if ((player == this.getPlayer1()
&& dest < 7)
|| (player == this.getPlayer2()
&& dest > 18)) {
// make sure it's in the correct quadrant
Integer dist = 0; // if this doesn't get changed below, something seriously bad is hapened
if (player == ... |
7a473a6b-d6ea-4e86-bbda-1588e29ba904 | 0 | public boolean isTuringMachine()
{
/*
* Sorry about this pretty cheap method.
*/
return simulator instanceof TMSimulator;
} |
c210673c-f22a-449e-861a-593586c06170 | 9 | public static void main(String[] args) {
String filename = args[0];
String separator = args[1];
In in = new In(filename);
ST<String, Queue<String>> st = new ST<String, Queue<String>>();
ST<String, Queue<String>> ts = new ST<String, Queue<String>>();
while (in.hasNextLine()) {
String line = in.readLine(... |
5d8bc9b7-c29e-4478-95fc-6223163174bf | 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 feel.
* For details see http://down... |
9a5bb3d8-08cf-4246-b956-40d8de064d4b | 2 | public static Entity getBiomeTree(Biome biome) {
switch (biome) {
case FOREST:
//return new TreeCarniferous(new Point());
case DESERT:
return null;
}
return null;
} |
39dd6434-871a-442a-940c-24628e9f774d | 7 | @Override
public boolean invoke(MOB mob, List<String> commands, Physical givenTarget, boolean auto, int asLevel)
{
if(commands.size()<2)
{
mob.tell(L("You must specify who or what to cast this on, and what you want said."));
return false;
}
final Physical target=mob.location().fetchFromRoomFavorItems(n... |
e57ce5e5-7cfe-41d5-a7fd-62d625ded55b | 4 | private void renderTopRow(Graphics2D g) {
List<List<Card>> topRow = game.getTopRow();
double x = X_BOARD_OFFSET;
double y = CARD_Y_NO_OVERLAP;
for (List<Card> cards : topRow) {
if (cards.size() > 0) {
Card toRender = cards.get(cards.size() - 1);
... |
7cb3f74f-8a32-4ff8-9c5e-71a483a57fe0 | 8 | public static void reduce(String str) {
char[] buff = str.toCharArray();
boolean keepGoing = true;
while (keepGoing) {
keepGoing = false;
int start = -1;
int end = -1;
for (int i = 0; i < buff.length; i++) {
if (buff[i] == 0)
continue;
if (start == -1) {
start = i;
continue;
... |
957a93e8-3010-44e7-acaa-b18d7ad4aaec | 8 | public static void corner(Component comp, final byte CORNER)
{
screenOffset();
Rectangle DEST;
switch (CORNER)
{
default:
case TOP_LEFT:
DEST = new Rectangle(offset,
0,
(int) comp.getSize().getWidth(),
... |
9e2ff85b-d50d-4141-82d9-cc07a090466f | 6 | private boolean r_Step_3() {
int among_var;
// (, line 81
// [, line 82
ket = cursor;
// substring, line 82
among_var = find_among_b(a_4, 7);
if (among_var == 0)
{
... |
bdcccd08-f956-416c-9c87-e39a57471d5c | 6 | private void operation() {
User attacker = getRandomUser();
if (attacker == null) {
System.out.println("NULL PTR ECPT!");
return;
}
int attackerDBID = galaxyIDToDBID.get(attacker.getGid());
int targetGalaxyID = attacker.getRandomTargetGID(1, 4);
int targetDBID = galaxyIDToDBID.get(targetGalaxyID);
... |
7e2f4711-cc9b-4410-aab4-10520d2221b7 | 3 | public void readExternal(ObjectInput paramObjectInput)
throws ClassNotFoundException, IOException
{
super.readExternalWithoutImages(paramObjectInput);
this.state = paramObjectInput.readInt();
this.frame = paramObjectInput.readInt();
this.victim = ((Robot)paramObjectInput.readObject());
this.vi... |
d42fb872-654e-4c8e-a8d2-8dcdb5c80d65 | 4 | @Override
public boolean isVisible() {
if (!getTab().isOpen()) {
return false;
}
final WidgetChild list = Widgets.get(EMOTE_WIDGET, EMOTE_LIST);
if (list == null || !list.validate()) {
return false;
}
final WidgetChild emote = list.getChild(childId);
return emote.visible() && list.getBoundingRectan... |
92557bb3-e109-439f-a005-f69814082489 | 2 | private DockLayout pushDown() {
DockLayout layout = new DockLayout();
layout.mParent = this;
for (int i = 0; i < mChildren.length; i++) {
if (mChildren[i] instanceof DockLayout) {
((DockLayout) mChildren[i]).mParent = layout;
}
layout.mChildren[i] = mChildren[i];
}
layout.mHorizontal = mHorizonta... |
006217f0-0e9d-4fac-a23b-fdae7b2fb6c1 | 9 | private boolean decode5(ByteArrayOutputStream baos)
throws PDFParseException {
// stream ends in ~>
int[] five = new int[5];
int i;
for (i = 0; i < 5; i++) {
five[i] = nextChar();
if (five[i] == '~') {
if (nextChar() == '>') {
... |
0ac6690e-c687-4299-a85a-5b3cd0f4477e | 6 | public static void comButtons() {
for (int i = 0; i < intrfce.Menu.BUTTONS.length; i++) {
if (r.intersects(intrfce.Menu.BUTTONS[i].r)) {
if (isPressed) {
intrfce.Menu.BUTTONS[i].isClicked = true;
intrfce.Menu.BUTTONS[i].isHoveredOver = false;
} else {
intrfce.Menu.BUTTONS[i].isClicked = fals... |
0c94ab23-5fb2-4584-b880-d4865cbc23cf | 3 | public void run ()
{
while (dir != null) {
// No matter how we learn that something may have
// changed, we do the same thing to figure out
// exactly what changed: scan usbdevfs
while (scan ())
continue;
// FIXME: add native support to poll() on
// /proc/bus/usb/devices ...
try { Thread.... |
020e19c3-2a1c-4b3a-a0a9-952dd750d9b0 | 9 | public synchronized int[] aaNumber2Pos() {
if (aa2pos != null) return aa2pos;
calcCdsStartEnd();
aa2pos = new int[protein().length()];
for (int i = 0; i < aa2pos.length; i++)
aa2pos[i] = -1;
int cdsMin = Math.min(cdsStart, cdsEnd);
int cdsMax = Math.max(cdsStart, cdsEnd);
// For each exon, add CDS ... |
f61f509c-a09c-41fb-8658-5cd22197238c | 9 | private void connectVoice() {
RtmpReader reader = null;
RtmpWriter writer = null;
if (audioFilename != null && audioFilename.length() > 0) {
if (sendAudio) {
try {
reader = new FlvReader(audioFilename);
} catch (Exception e) {
e.printStackTrace();
log.error("Can't create a FlvReader inst... |
e68237e1-c465-49b3-a0bc-81e4c8b289f9 | 1 | private void notifyObservers(Roll roll) {
for (Observer o : observers) {
o.updateObserver(this, roll);
}
} |
af771378-2781-4bc6-9e9c-cfbe87408126 | 0 | public void reset() {
this.state = State.DEFAULT;
} |
657e7aaf-c6f8-4ef6-aa1c-146db0af0fd8 | 7 | public static String humanReadableBytes(long bytes, boolean si)
{
// This algorithm doesn't like negatives
boolean positive = true;
if(bytes < 0)
{
bytes = -bytes;
positive = false;
}
// Figure out if we're using powers of 2 (non-SI) or 10 (SI)
int unit = si ? 1000 : 1024;
if(bytes < unit)
{
... |
d5650e4e-f68d-4d58-a80c-fc4e830cebbf | 6 | public void ron(String[] split, String command)
{
if (split.length != 6)
{
PrintMessage("Syntax:!ron [game] [winner] [hou] [han|y|dy] [loser]");
return;
}
TournyGame m = (TournyGame) games.get(split[1]);
if (m == null)
{
PrintMessage(split[1] + " is not a valid game");
return;
}
String p =... |
284e085a-2f14-4d79-8b64-3da53080ba0e | 0 | public void rotACW()
{
forme.rotACW();
} |
1825537f-f0ad-4bf4-8e2c-3b100e899c53 | 6 | private float[] toCmyk(float[] colorvalue) {
float y = colorvalue[0], cb = colorvalue[1], cr = colorvalue[2], k = colorvalue[3];
float[] cmyk = new float[4];
float v;
v = (float) (1.0 - (y + 1.402 * (cr - 0.5)));
cmyk[0] = v < 0.0f ? 0.0f : (v > 1.0f ? 1.0f : v);
v = (flo... |
f6860883-49b9-41eb-9bd6-0b48d0f6a014 | 9 | public static void inicializar(String repositoryType){
switch(repositoryType){
case "array":
compras = new ManagerCompras(comprasArray);
contas = new ManagerConta(contasArray);
servicos = new ManagerServico(servicosArray);
break;
case "arquivo":
String pathname = "planilha.xls"; //Guarda o caminho ... |
1decf8bf-fd0f-4aac-b6cf-88b03e934aad | 9 | public void saveProjectFile(String statFilePath) {
Element stat = new Element("stat");
Document statDoc = new Document(stat);
//load meta-data elements
Element metaDataElement = new Element("metadata");
for (String attrib : METADATA_ATTRIBS) {
String value = metaDat... |
3429ecf7-23c2-46bd-a5f8-9491780287eb | 5 | private static void drawRightToLeft(Graphics g, LivingEntity e, int x, int y, int size) {
float ratio = tex.bar[0].getWidth() / (float)e.getMaxHP();
int sizeX = tex.frame[0].getWidth() * size;
g.drawImage(tex.frame[3], x - sizeX, y, sizeX, tex.frame[0].getHeight() * size, null);
int colo... |
73c2a594-2c3c-4acc-b67a-999e7e7ee94f | 9 | private void asignarFitness() {
//Marcar la poblacion como no dominada
for (Individuo ind : poblacion) {
ind.setDominado(false);
}
int frentes = 0; // cuenta de frentes
double df = (double) qap.getN(); // dummyFitness para la poblacion inicial
List<Individuo... |
bbdd788e-5092-4c2e-bad0-72196857a5c7 | 8 | public static Map<String, Class<?>> propertyMap(Class<?> baseClass) {
Map<String, Class<?>> map = new HashMap<String, Class<?>>();
Method[] methods = baseClass.getMethods();
for (Method method : methods) {
String name = method.getName();
if (name.startsWith("get")) {
... |
02c2f6fd-ec52-4762-8d64-e1377e1474c3 | 8 | public ArrayList<Integer> AllEmpIDInFranchise(int FranID)
throws UnauthorizedUserException, BadConnectionException, DoubleEntryException
{
/* Variable Section Start */
/* Database and Query Preperation */
PreparedStatement statment = null;
ResultSet results = ... |
81cdeab3-1be3-4152-9c91-bc600efe959b | 2 | public static void main(String[] args) throws D2S_ModuleException, D2S_ModuleParameterException {
if (args.length < 3) {
System.out
.println("\nModuleWrapper\n" +
"Please use the following arguments: \n" +
"[1] - The Java Class that is your module (use the full package path)" +
"[2] - ... |
06712bf8-5557-4b46-b4d3-88e699c9ad92 | 7 | public void make_pivot_hier(node head){
// stop if so less than OUTLIERS_SIZE objects present
if(head.list_objects.size() < PIVOT_SIZE_TOTAL){
//add all children to the children and return
for(finger_print f: head.list_objects){
head.children.add(new node(f));
}
//System.out.println("XX "+head.li... |
434ab210-17e8-430d-88d6-a22af82f036d | 9 | private void connectVerbInstanceBaseToFeatures() {
for (int CA = 0; CA < getSize() / vInstCASize; CA++) {
for (int baseNeuron = 0; baseNeuron < 40; baseNeuron++) {
for (int feature = 0; feature < 13; feature++) {
int fromNeuron = baseNeuron + (CA * vInstCASize);
for (int synapse = ... |
3d6088b2-2917-495b-9b17-537fe6285ae6 | 8 | public boolean isBestMovebidiDLS(Site node, Site target, int depth) {
if(depth >= 0) {
boolean worked = true;
for(Site tChild: graph.neighbors(target)) //base case
worked = worked && graph.neighbors(node).contains(tChild);
if(worked) return worked;
... |
0fe9fffd-79c2-49f8-b622-13e7d448f796 | 1 | private boolean jj_3_80() {
if (jj_scan_token(NO)) return true;
return false;
} |
4f9b7df8-781e-4e7b-8dda-14937e11c8ab | 4 | public static int characterSize(int character) throws JSONException {
if (character < 0 || character > 0x10FFFF) {
throw new JSONException("Bad character " + character);
}
return character <= 0x7F ? 1 : character <= 0x3FFF ? 2 : 3;
} |
a3370612-3fec-4f89-ac27-9a4334cb112d | 7 | @Override
public void analysis() {
int halfOfWidth = this.currentWidth / 2;
/*if (controlPoints.get(currentControlPointToReach).getY() < currentCoord.getY()) {
System.out.println("jumping");
setHeroOwnVerticalSpeed(-OWN_VERTICAL_SPEED);
}*/
if ((controlPoints.... |
44a77143-6157-4c69-b876-3deb7e6aab05 | 9 | private int sweep() {
int nDeallocated = 0;
long pos;
gcDone = true;
for (int i = dbFirstUserId, j = committedIndexSize; i < j; i++) {
pos = getGCPos(i);
if (pos != 0
&& ((int) pos & (dbPageObjectFlag | dbFreeHandleFlag)) == 0) {
int bit = (int) (pos >>> dbAllocationQuantumBits);
if ((blac... |
c1d3f110-8dc8-4007-8f2a-cb7adec29a85 | 4 | protected void addWallObject(int x, int y, int z, int drawHeight,
int orientation, int orientation2, int uid, Animable renderable,
Animable renderable2, byte objConf) {
if (renderable == null && renderable2 == null)
return;
WallObject wallObject = new WallObject();
wallObject.uid = uid;
wallObject.objC... |
06da28ad-b76b-4c0e-a3d5-f75e0fea8c3a | 8 | public ArrayList<Double> barHeight() {
ArrayList<Double> values;
values = A;
ArrayList<Double> barDimen = new ArrayList<Double>(); //Convert to ArrayList
double numBars = n;
double sum = 0; //Sum of values
//double classNum = 0; //Number of classes: sum of values divided... |
92ba02f1-9dd9-4be0-88ab-671ef221b0b1 | 9 | @Override
public boolean equals(final Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
MongoCredential that = (MongoCredential) o;
if (mechanism != null ? !mechanism.equals(that.mechan... |
bb311dcf-6fc4-4a33-9d8d-9852b24f8d61 | 3 | public void mouseEntered(MouseEvent e) {
if (!b.isEnabled()) return;
if (b instanceof javax.swing.JToggleButton && b.isSelected())
return;
b.setBorder(raised);
b.setBorderPainted(true);
} |
59c253d7-a3e4-4ce3-a5f9-638945e6e42e | 3 | public boolean rmNode(final Node n) {
synchronized (nodes) {
if (nodes.containsKey(n.getRemoteAddress())) {
nodes.remove(n.getRemoteAddress());
addresses.remove(n.getRemoteAddress());
if (nodes.size() == 0 && closeIfEmpty) {
close();
}
return true;
} else {
return false;
}
}... |
1418c917-39a3-47cb-9014-b191010d181d | 9 | public int searchEdgesToSetNull(Edge[] list, Vertex in, Vertex out, int index){
int edgePos = -1;
for(int i = 0;i < numEdges; i++){
if(list[i]!=null && list[i].inVertex != null && list[i].outVertex != null){
//checking for exact match with an edge
//System.out.println("***** List[i]:: "+list[i].inV... |
6c1b6f08-f3de-4b24-89e9-83e97885843f | 6 | private static byte[] encode3to4(byte[] source, int srcOffset,
int numSigBytes, byte[] destination, int destOffset, byte[] alphabet) {
// 1 2 3
// 01234567890123456789012345678901 Bit position
// --------000000001111111122222222 Arra... |
f2a83db8-3940-4cf9-9400-6832d8974153 | 3 | public static void main(String[] args) {
if (args.length < 2) {
System.out.println("Usage:\njava TestRegularExpression "
+ "characterSequence regularExpression+");
System.exit(0);
}
System.out.println("Input: \"" + args[0] + "\"");
for (String arg : args) {
System.out.println("Regular expression: ... |
7683d93e-e7a6-4c20-840e-44a97a690cc1 | 0 | public String getName() {
return name;
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.