method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
6f9b807f-afbe-4b8b-a6af-066626464be7 | 5 | public void tryMoveLeft(final Block[][] tank) {
// Don't escape the tank
if (coord.getX() <= 0) {
return;
}
// Make sure there is space to move into
for (int x = 0; x < layout.length; x++) {
for (int y = 0; y < layout[0].length; y++) {
if ... |
453a8c6d-1c63-4291-9a1b-61375d547569 | 2 | public void VerificaColisao(Polygon colisor , String tag) {
for (Point vertice : vertices) {
Point ponto = new Point(vertice);
if (colisor.contains(ponto)) {
this.tag = tag;
delete = true;
}
}
} |
276edd5b-acba-48f3-9171-9cdbaf119f98 | 8 | public void update(boolean shouldUpdate)
{
if(shouldUpdate == false) return;
if(flashFlag == true)
{
setColor(Color.red);
damageTime++;
}
if(damageTime == 10)
{
damageTime = 0;
flashFlag = false;
}
if(flashFlag == false) setColor(originalColor);
if(countDown == true)
{
se... |
4817b62f-5442-4ca2-ab67-de9d4bec78ff | 9 | protected void computeRect(Raster[] sources,
WritableRaster dest,
Rectangle destRect) {
Raster source = sources[0];
Rectangle srcRect = mapDestRect(destRect, 0);
int formatTag = MediaLibAccessor.findCompatibleTag(sources,dest);
... |
5fc0b40f-54df-4c61-8b59-087cb79a7fa5 | 0 | public int getValue() {
return value;
} |
6aa5e7ff-1aec-4e1e-acb9-4eb0567952b5 | 5 | public void suoritaVuoro(int kuka, int rivi, int sarake) {
if ((kuka == 1 || kuka == 2) && this.pelinTila == 1) {
this.poyta[rivi][sarake] = kuka;
}
if (this.vuoro == 1) {
this.vuoro = 2;
} else if (this.vuoro == 2) {
this.vuoro = 1;
}
} |
f4b5f19e-0e2a-48fc-81f4-f40372541649 | 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... |
aaa5e0b2-10a3-4885-ad17-9b15e723fb33 | 4 | public String lastStr() {
switch(lastType) {
case ULSTRING:
return yytext();
case DLSTRING:
return getDLString();
case COMMENT:
return getComment();
case IDENT:
return getIdent();
default:... |
ddbb659d-864b-442a-bdf3-cf4e65452a2c | 2 | public static byte[][][] reverseSubKeys(byte[][][] subKeys) {
byte[][][] reversedSubKeys = new byte[subKeys.length][][];
for (int i = 0; i < subKeys.length; i++) {
int reversedI = subKeys.length - 1 - i;
reversedSubKeys[reversedI] = new byte[subKeys[i].length][];
for ... |
439c6972-bb69-4238-b14f-7d54ec9122f5 | 5 | @Override
public void run () {
tiempoActual = System.currentTimeMillis();
while (vidas > 0) {
perdio=false;
// if (sonidillo) {
// if (!fondoM.getLooping()) {
// fondoM.setLooping(true);
// fondoM.play(... |
974c5d00-ba41-4a46-99c1-592daed35aa6 | 7 | public void p_leap_year_validation(
LinkedHashMap<String, LinkedHashMap<String, String>> credentials) {
autoutil.openBrowser(dataSheet(credentials,"url","url"));
autoutil.waitTime(8000);
autoutil.clickButton(dataSheet(credentials,"button","sign"),propFile("link"));
autoutil.waitTime(3000);
for(Entry<Stri... |
40f2ccbb-1c51-44a7-938b-0bd1e6af17dd | 6 | public static Command processArgs(String[] args, String programName)
throws Exception {
if(args.length == 0) {
printHelp(programName);
return null; // Never reached
}
if(args.length == 1) {
return new Command(args[0], null, null, Command.Commands... |
edb0f08a-d99a-4d9f-8737-1e59cae3ea1e | 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... |
f208d00d-de25-48fe-b82f-10e03eec72d4 | 0 | @Override
public String toString()
{
return "any()";
} |
2974d16b-2102-434c-a1d1-d38b25f9dd1b | 4 | public void updateBlockState(State state, World world, int x, int y, int z)
{
int metadata = world.getBlockMetadata(x, y, z);
TileEntity te = world.getTileEntity(x, y, z);
changingState = true;
switch (state)
{
case IDLE:
world.setBlock(x, y, z, GraphiteM... |
dd6ab060-450f-4e27-950e-a166698a3b8e | 9 | public E execute(ElementContext<E> context) {
Number element = context.getElement();
if (element == null) {
return null;
}
if (element instanceof Long) {
return (E)Long.valueOf(element.longValue() + number.longValue());
}
if (element instanceof Integer) {
return (E)Integer.valueOf(element.in... |
569ca660-d7a7-4459-a45f-b47cda08fded | 7 | protected void validateParameters(){
this.id = (parameters.get("id") != null) ? Integer.parseInt(parameters.get("id").toString()) : null;
this.name = (parameters.get("name") != null) ? parameters.get("name").toString() : null;
if (this.id == null){
error = "ERROR 302 :: PARAMETER IS NOT PASSED (id)";
ret... |
24fb07ce-bfbf-4ea9-8bea-52c632aec027 | 8 | @Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (!super.equals(obj))
return false;
if (getClass() != obj.getClass())
return false;
FuzzyQuery other = (FuzzyQuery) obj;
if (Float.floatToIntBits(minimumSimilarity) != Float
.floatToIntBits(othe... |
19e47292-aa11-4cf5-a2b0-92c7471b011c | 5 | public void calGraphicBoardArray(){
h = this.getHeight();
w = this.getWidth();
int hp = h/11;
int sqNo = 1;
squares = new Square [8][8];
for (int row = 0; row < 8; row++){
for (int col = 0; col < 8; col++){
//if row number is even
if (row%2 == 0){
//if column number is even
if (col%... |
eabcc189-2602-4b77-8fd7-3005bfa6884d | 5 | public static void makeParam() {
BigInteger ZERO = BigInteger.ZERO;
BigInteger ONE = BigInteger.ONE;
BigInteger TWO = BigIntegerUtil.TWO;
int Lp = 512;
int Lq = 511;
Random sc = new SecureRandom();
int k = Lp; // prime number with k=512 bits
int certainty = 100; // The probability that... |
cedb945b-9ff5-4c6f-9f20-ce5f350006fb | 3 | @Override
public void actionPerformed(ActionEvent e) {
switch(e.getActionCommand()){
case BTServerUIActionCommands.SERVER_START:
mainController.startServer();
break;
case BTServerUIActionCommands.SERVER_STOP:
mainController.stopServer();
break;
case BTServerUIActionCommands.SEND... |
38d2e7fe-a32f-4a13-be6b-b50fdd097416 | 3 | private static void executeFinalStep(String outputFileName,
final GridProcessingManager gpm) throws IOException {
List<Integer> history = gpm.getShortestHistory();
String result = "";
if (history.isEmpty()) {
result = "No result";
} else {
for (int i = 0; i < history.size(); i++) {
result += his... |
8846c7e1-051a-46de-ae83-50ac09c2abea | 4 | public static final File getFile(String pathname, boolean inClassPath) {
if (inClassPath) {
char char0 = pathname.charAt(0);
if (char0 != '/' && char0 != '\\') {
pathname = '/' + pathname;
}
try {
return new File(FileUtil.class.getResource(pathname).toURI());
} catch (URISyntaxException e) {
... |
80cb43d2-60ae-4123-8fb8-d932228c7e02 | 4 | public void saveCode(List<String> lines, String outputLocation) {
try {
PrintStream printStream = new PrintStream(new FileOutputStream(outputLocation));
int lineNum = 0;
for (String s : lines) {
printStream.println(lineNum + ": " + s);
lineNum... |
42c8097a-7e1e-40e2-a758-54d3a4f5c67c | 5 | private boolean isViewClass(SootClass theClass) {
if (theClass == null)
return false;
// To make sure that nothing all wonky is going on here, we
// check the hierarchy to find the android view class
boolean found = false;
for (SootClass parent : Scene.v().getActiveHierarchy().getSuperclassesOf... |
c342150c-6d52-43fb-8808-13ae5ef4168e | 0 | @Override
public SocialProfileType getSocialProfileType() {
return socialProfileType;
} |
53f5b3da-7468-47cc-be59-ea6001f72e39 | 4 | boolean isPermutation3(String s1, String s2) {
if (s1.length() != s2.length()) {
return false;
}
int[] letters = new int[256];
for (int i = 0; i < s1.length(); i++) {
letters[s1.charAt(i)]++;
}
for (int i = 0; i < s2.length(); i++) {
letters[s2.charAt(i)]--;
if (letters[s2.charAt(i)] < 0) {
... |
d3dae369-015d-418c-9272-4a3af4dcdc5c | 9 | public void processKeyInput(KeyEvent e2){
if((e2.getKeyCode() == KeyEvent.VK_UP || e2.getKeyCode() == KeyEvent.VK_W))
game.getPlayers().get(0).processInput(PlayerInput.ROTATE);
if((e2.getKeyCode() == KeyEvent.VK_DOWN || e2.getKeyCode() == KeyEvent.VK_S))
game.getPlayers().get(0)... |
16a6bd64-570d-4734-8470-87e980baa5de | 3 | private List<Car> getAvailableCars(String carType, Date start, Date end) {
List<Car> availableCars = new LinkedList<Car>();
for (Car car : cars) {
if (car.getType().getName().equals(carType) && car.isAvailable(start, end)) {
availableCars.add(car);
}
}
return availableCars;
} |
ee955cf0-db6f-4b77-962c-ac1330aa050e | 7 | public static StandardObject baseTypeToTypeSpec(StandardObject self) {
{ Surrogate testValue000 = Stella_Object.safePrimaryType(self);
if (Surrogate.subtypeOfSurrogateP(testValue000)) {
{ Surrogate self000 = ((Surrogate)(self));
{ Stella_Class renamed_Class = ((Stella_Class)(self000.surrog... |
0b3b9495-e317-4ad2-895e-49dd596592f6 | 9 | public boolean SegmentIntersectRectangle(double a_rectangleMinX, double a_rectangleMinY,
double a_rectangleMaxX, double a_rectangleMaxY, double a_p1x, double a_p1y,
double a_p2x, double a_p2y)
{
double minX = a_p1x;
double maxX = a_p2x;
if (a_p1x > a_p2x)
{
... |
8540c9f9-e514-4791-808c-d77902bad635 | 5 | private String decoration2Dot(Styles.Decoration decoration) {
switch (decoration) {
case Arrow:
return "vee";
case Aggregation:
return "odiamond";
case Composition:
return "diamond";
case Inheritance:
... |
15db7241-a777-4c5e-9181-44cfe20faf63 | 8 | private void translateQuantity() throws RegexSyntaxException {
String lower = parseQuantExact();
int lowerValue = -1;
try {
lowerValue = Integer.parseInt(lower);
result.append(lower);
}
catch (NumberFormatException e) {
// JDK 1.4 cannot handle ranges bigger than this
result.... |
9e0a59e4-85b4-4de9-a99b-3736527d7e6f | 2 | private void paintIntoImage() {
final int w = image.getWidth();
final int h = image.getHeight();
for (int y = 0; y < h; y++) {
for (int x = 0; x < w; x++) {
image.setRGB(x, y, getColor(x, y));
}
}
} |
fe6dd04c-d635-46ba-a89c-ed73046c4677 | 6 | @Override
public List<String> getSuggestions(CommandInvocation invocation)
{
List<String> tokens = invocation.tokens();
List<String> result = new ArrayList<>();
if (invocation.isConsumed())
{
for (CommandBase command : this.getCommands())
{
... |
307b8927-c6ea-4c1a-a3da-d1162c466f26 | 7 | public void run(){
System.out.println("begin to synchronize file data...");
while(true)
{
try
{
while(MyEventQueue.fileEventList.size() != 0)
{
FileEvent fv = MyEventQueue.fileEventList.poll();
switch(fv.getCatogory())
{
case 1: processRenameEvent(fv);
break;
case 2: p... |
36a5004b-8b11-4d2c-80ac-c0dfcaae9d7c | 1 | @Override
public List<Integer> update(Criteria beans, Criteria criteria, GenericUpdateQuery updateGeneric, Connection conn) throws DaoQueryException {
List paramList1 = new ArrayList<>();
List paramList2 = new ArrayList<>();
StringBuilder sb = new StringBuilder(UPDATE_QUERY);
String ... |
d16a14d8-ef04-485b-a187-227d405513b7 | 9 | private void loadPathwaysFromXMLNode(Node graphElement) {
NodeList pathwaysnodes = graphElement.getChildNodes();
for (int i = 0; i < pathwaysnodes.getLength(); i++) {
Node pathwaynode = pathwaysnodes.item(i);
// GraphData/Pathways/Pathway
if (pathwaynode.getNodeName(... |
695b15df-db05-4caa-9b98-18cec1705340 | 5 | public boolean OpenDatabase() {
try {
Class.forName("org.sqlite.JDBC");
Conn = DriverManager.getConnection("jdbc:sqlite:plugins/" + plugin.getName() + "/" + DBFilename);
IsConnected = true;
if (TableExists(Conn, "birthdaygift")) {
// Check/update existing table
if (!ColumnExists(Conn, "birthda... |
4634a7e8-44b1-4cee-8fb9-726ecc4f2a25 | 9 | private void load(Class<?> source, String name, Class<?>... parameterTypes) {
if (source == null) {
new Exception("Can not load method '" + name + "' because the class is null!").printStackTrace();
return;
}
// try to find the field
Class<?> tmp = source;
while (tmp != null) {
try {
this.method =... |
114a6e0b-2098-4359-a62c-ce9063c7d364 | 5 | private int findSlashName(byte[] d, String name) {
int i;
for (i = 0; i < d.length; i++) {
if (d[i] == '/') {
// check for key
boolean found = true;
for (int j = 0; j < name.length(); j++) {
if (d[i + j + 1] != name.charAt(j... |
91ef42d7-451f-4002-a287-8ca678001e3b | 4 | public void actionPerformed(ActionEvent arg) {
Object ev = arg.getSource();
if(ev == m_tabbutton)
{
addTab("New Client!");
}
if(ev == submit)
{
addClientTab("Submitted Client");
}
if("Exit".equals(arg.getActionCommand()))
{
System.exit(0);
}
if("New Client".equals(arg.getActionComm... |
cc48743c-0527-4381-bc61-ea4eb76188cf | 0 | public String getOnline() {
return online;
} |
fb26995c-824c-4978-9d5e-af0d40fb3fd5 | 5 | @Override
public int hashCode() {
int result = name != null ? name.hashCode() : 0;
result = 31 * result + (type != null ? type.hashCode() : 0);
result = 31 * result + (label != null ? label.hashCode() : 0);
result = 31 * result + (monoMassDeltas != null ? monoMassDeltas.hashCode() : ... |
461dce14-d841-4e16-a7bc-a7dfa0973fcb | 9 | public void draw(Graphics g) {
for (int i = 0; i < aliensList.size(); i++) {
Aliens a = aliensList.get(i);
boolean draw = true;
if (Game.inGame) {
if (a.isVisible()) {
if (player.bullets.size() > 0) {
for (int j = 0; j < player.bullets.size(); j++) {
if (a.getBounds().intersects(player.... |
218e2646-0f75-425b-b7d8-77a4440c662c | 5 | public void render(Graphics g, List<Player> players){
List<Player> left = new ArrayList<Player>();
List<Player> right = new ArrayList<Player>();
left.add(players.get(0));
//Split players into teams
for (Player p: players){
if (p.getHero().getTeam().equals(players.get(0).getHero().getTeam())){
l... |
ddd80160-11b3-4242-9aa9-aba247720364 | 1 | public static String toString( double[] vector )
{
String result = "";
for ( int i = 0; i < vector.length; ++i )
result += fillString(Double.toString(vector[i]), 24) + "\n";
return(result);
} |
046fba1f-55fe-4d8b-9872-19b9ff8bb765 | 2 | public static int commonPassengersCount( PassengerTrain train ){
int res = 0;
for ( RailwayVehicle it : train ){
if ( it instanceof PassengerCar ){
PassengerCar pCar = (PassengerCar)it;
res+= pCar.getPassengersCount();
}
}
return res;
} |
51671355-8f10-402f-a0ee-208617b53118 | 9 | public void reduce(IntWritable key, Iterator<Text> values, OutputCollector<Text, IntWritable> output, Reporter reporter)
throws IOException {
ArrayList<Integer> nowGList = new ArrayList<Integer>();
// generate nowGList
for (Entry<Integer, Integer> entry : GList.entrySet()){
if (entry.getValue... |
4b0d4509-537a-4720-8c11-61504f199e9f | 1 | public void finalizeFunctionalRequirements() {
for (FunctionalRequirement functionalRequirement : functionalRequirements)
functionalRequirement.calculateCoefficient();
} |
ee3e1347-39bf-4bae-8621-ea5582070266 | 8 | public void generateMinutesVsFreq() throws IOException {
minutesVsFreqFileWriter = new BufferedWriter(new FileWriter(minutesVsFreqFile));
TreeMap<Long, Long> minutesVsFrequency = new TreeMap<Long, Long>();
for( Long rootId : roots ) {
Long minId = Long.MAX_VALUE, maxId = Long.MIN... |
4c550531-fe9c-4446-98a0-0a418bdf5a86 | 3 | public void login() throws JSONException, LoginException, IOException {
RestClient client = new RestClient("https://" + pve_hostname
+ ":8006/api2/json/access/ticket");
client.addParam("username", pve_username);
client.addParam("password", pve_password);
client.addParam("realm", pve_realm);
try {
clien... |
395d16bf-58c3-405e-8e2b-dd41df1c3dd1 | 9 | public void enter(InstructionInfo instruction, XPathContext context) {
int loc = instruction.getConstructType();
if (loc == StandardNames.XSL_FUNCTION || loc == StandardNames.XSL_TEMPLATE) {
String tag = "<";
tag += (loc==StandardNames.XSL_FUNCTION ? "function" : "template");
... |
7b573e48-27a5-4011-a6dc-ae403a6f4b92 | 6 | public String letterCountsHelper(int number){
String base[]={"zero","one","two","three","four","five","six","seven","eight",
"nine","ten","eleven","twelve","thirteen","fourteen","fifteen","sixteen","seventeen","eighteen","nineteen"};
String tens[]={"twenty","thirty","forty","fifty","sixty","seventy","eighty"... |
32764007-659d-4788-9133-67358eec36b6 | 4 | private void buildTrain() throws Exception
{
IRailwayRepository repo = this.getSite().getRequiredService(IRailwayRepository.class);
this._route = Queries.query(this._train.getTrainNumber().getRoutes()).first(new Predicate<Route>(){
@Override
public boolean evaluate(Route r) throws Exception {
... |
c392385a-fd1e-4f69-ab07-1e2d800835a9 | 4 | @Override
public final void run() {
System.out.println("============= MulticastReceiverThread ================");
byte[] buf = new byte[1024];
try {
while (!stopped) {
DatagramPacket packet = new DatagramPacket(buf, buf.length);
... |
aefbbe27-9793-46cf-89b0-1bf2beda5a02 | 5 | public static String make(Set<Cluster> clusters){
/*
* compute the parameters required
*/
int num_nodes = 0;
Set<Integer> cluster_nodes = new HashSet<Integer>();
Set<Pair<Integer,String>> nodes = new HashSet<Pair<Integer,String>>();
Set<Pair<Integer,Integer>> edges = new HashSet<Pair<Integer,Integ... |
ac357c61-77d9-4fae-af84-d73d19af64a7 | 8 | private Rotation(Point[] c, int r) {
coords = new Point[4];
for (int i = 0; i < 4; ++i) {
coords[i] = new Point(c[i]);
}
// Rotate an appropriate number of times
for (int i = 0; i < r; ++i) {
for (Point p : coords) {
p.setLocation(p.y, -p.x);
}
}
// Cache ... |
047ecc22-a05a-4b7b-a464-94339d92e381 | 2 | @Override
public void onMouseButtonPress(int buttonID)
{
for(GuiButton button : buttons)
{
if(button.isMouseOver())
{
Sound.button_hit.play();
button.onClick();
}
}
} |
6d0c4fe4-2d4b-4024-8455-ea02c9d1ab2e | 7 | public String format(LogRecord lr) {
Date date = new Date(lr.getMillis());
StringBuffer sb = new StringBuffer();
sb.append(_numberFormat.format(lr.getSequenceNumber())).append(";");
sb.append(_absoluteMillisecondsFormat.format(date)).append(";");
Level l = lr.getLevel();
if (l == Debug.ERROR)
sb.ap... |
ee782f00-2dc5-4c52-80a9-5a72bd66dc4d | 0 | public void requestHold(){
//Scanner input = new Scanner(System.in);
//System.out.print("Enter player hold limit: ");
//hold = input.nextInt();
hold = 17;
} |
116120fc-4a96-4c4b-8c34-93c849b4dedc | 8 | @Override
public void run() {
long answer = 0;
long[] pentagonalNumbers = new long[5000];
for(long i = 1; i <= 5000L; i++) {
pentagonalNumbers[(int) (i - 1)] = (long) (1.5 * Math.pow(i, 2) - 0.5 * i);
}
boolean found = false;
int counter = 0;
while(!found && counter < 5000) {
for(int j = 0; j < p... |
673f9e3a-3bf1-45ed-9831-a575228c8bd5 | 8 | @Override
public void mouseMoved(int oldx, int oldy, int newx, int newy) {
mousePos.x = newx;
mousePos.y = newy;
switch(interactionState){
case normal:
case selected:
if(gui.isOnGui(newx, newy)){
PlayerAction a = gui.isOnActionList(newx, newy);
if(a == null){
selectedTowerDef = null;
... |
eadf7eb5-1d63-4d02-9041-2d8699b2ea26 | 6 | private void handleGroups(AjaxRequest vars, HttpServletRequest request, HttpServletResponse response) {
EntityManager em = getEntityManager();
GroupDefinitionDao dbDefinition = new GroupDefinitionDao(em);
CustomerDao dbCustomer = new CustomerDao(em);
if (vars.getAction().equals("groupsL... |
922a2b68-2638-484e-a73c-524a2606ba33 | 4 | private void printAll(TreeNode root, TreeNode parent, Node parentNode, int parentPosition) {
Node p;
if (root != null && parent == null) {
p = makeNode(root.value, new Point(parentPosition, getRectNextTop(0)), Node.COLOR_PARENT);
} else {
p = parentNode;
}
... |
5698d1a3-0836-4ae7-9455-a45f428758e8 | 2 | FillPrescription(Gui frame){
GridBagConstraints c = new GridBagConstraints();
JLabel picLabel=new JLabel();
picLabel.setIcon(new javax.swing.ImageIcon(getClass().getResource("/phms_se/resources/img/bg.jpg")));
this.add(picLabel);
picLabel.setLayout(new GridBagLayout());
this.setLayout(new Gr... |
a18c5448-6f66-40a1-8524-db7d5e38efbe | 6 | public Value execute(Interpreter machine) throws MyException {
if (_operands != null && _operands.size() == 2
&& _operands.get(0).isSymbol()) {
Value n = _operands.get(1).execute(machine);
Value p = _operands.get(1).execute(machine);
Expr s = _operands.get(1);... |
c89bcc3d-38e5-4f50-a995-40932a8268ab | 7 | public void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, java.io.IOException {
try
{
HttpSession session = request.getSession(true);
UserBean currentUser = ((UserBean) (session.getAttribute("currentSessionUser")));
EmpresaDAO busqueda =... |
8e2958b0-ee6f-4e80-b49a-a1d909eadc9d | 8 | public boolean equals(User u) {
if (this.activeScheduleId != null
&& !this.activeScheduleId.equals(u.activeScheduleId)) {
return false;
}
if (this.activeScheduleId == null && u.activeScheduleId != null) {
return false;
}
if (!pass.equals(... |
5b319854-8f56-4a46-807f-f3ae2faed4ad | 2 | public String toString(){
StringBuffer sb=new StringBuffer();
sb.append("[")
.append("total=").append(total)
.append(",pages=").append(pages)
.append(",pageNumber=").append(pageNumber)
.append(",limit=").append(limit)
.appen... |
aeda3d23-5775-428a-9ede-d1ac2033dd9c | 9 | public boolean skipPast(String to) throws JSONException {
boolean b;
char c;
int i;
int j;
int offset = 0;
int n = to.length();
char[] circle = new char[n];
/*
* First fill the circle buffer with as many characters as are in the
* to string. If we... |
876b14c3-a66a-43c4-b0d5-635f4f3f4738 | 0 | public CheckResultMessage check12(int day) {
return checkReport.check12(day);
} |
e3f3a556-c4c6-48d8-a5f7-6ede96da60df | 7 | static int pushRelabel(int [][]C, int source, int sink) {
int[][] F = new int[n][n];
int []excess = new int[n];
int []height = new int[n];
int []list = new int[n];
int []seen = new int[n];
int i, p;
for (i = 0, p = 0; i < n; i++){
if((i != source) && (i != sink)) {
list[p] = i;
p++;
}
}... |
74d43cf7-559e-4882-b383-6930be627c8c | 4 | public void run()
{
Socket sckOut = null;
InetSocketAddress isaTmp = null;
try
{
sckOut = new Socket();
sckOut.bind
(
new InetSocketAddress
(
EzimNetwork.localAddress
, 0
)
);
isaTmp = new InetSocketAddress
(
this.addr
, this.port
);
sckOut.connect(isaTmp,... |
36922beb-b763-4a2b-9e45-4cc3a27b739d | 7 | private boolean func_75230_a(MerchantRecipe par1MerchantRecipe, ItemStack par2ItemStack, ItemStack par3ItemStack)
{
ItemStack itemstack = par1MerchantRecipe.func_77394_a();
ItemStack itemstack1 = par1MerchantRecipe.func_77396_b();
if (par2ItemStack != null && par2ItemStack.itemID == itemsta... |
3b3abfba-07cf-4e0a-a5b7-6ffe31378a7b | 1 | @Test
public void testReserveValidParameters()
{ int x;
try {
assertEquals(new Book().Reserve(56342,1111112),1);
} catch (IOException e) {
System.out.println("Invalid data");
}
} |
6317d5bd-39fa-4644-9a8b-f6ed33e86530 | 3 | public static void titanicResult(String filename, Dataset dataset)
{
try
{
FileOutputStream fos = new FileOutputStream(filename);
PrintStream ps = new PrintStream(fos);
ps.println("PassengerId,Survived");
for(Instance inst : dataset.data)
{
if(inst.type == InstanceType.Test)
ps.println(ins... |
aa5c9dcb-0c30-4e42-b0c4-f496a38631d2 | 0 | public HashSet<Integer> getStates() {
return new HashSet(FiniteTreesTable.keySet());
} |
4cddacb7-2efc-4cfc-9bda-09b7846ea7be | 1 | public static void showNew() {
if (DIALOG == null)
DIALOG = new NewDialog();
DIALOG.setVisible(true);
DIALOG.toFront();
} |
e7ef4f80-6377-43ff-a902-e9099304f0ff | 6 | private static Image getImage(String filename) {
// to read from file
ImageIcon icon = new ImageIcon(filename);
// try to read from URL
if ((icon == null) || (icon.getImageLoadStatus() != MediaTracker.COMPLETE)) {
try {
URL url = new URL(filename);
... |
dbfa91a6-7c70-410c-95b9-aa315d7bdc58 | 8 | private void drawEdge(Graphics g, Edge e) {
String weight = "";
weight += e.getWeight();
int x1 = e.getStart().getX();
int y1 = e.getStart().getY();
int x2 = e.getEnd().getX();
int y2 = e.getEnd().getY();
g.setColor(Color.LIGHT_GRAY);
if (e.getStart() != e... |
eba83a5e-1618-4900-b2d2-3a1450a6b68f | 1 | @Override
public void initializeLanguage() {
Array<Letter> lettersAvailable = this.getLanguage().getLettersAvailable();
char[] letterDistribution = new char[] { 'e', 'e', 'e', 'e', 'e', 'e', 'e', 'e', 'e', 'e', 'e', 'a', 'a', 'a',
'a', 'a', 'a', 'a', 'a', 'a', 'a', 'a', 'a', 'a', 'a', 'i', 'i', 'i', 'i', 'i', ... |
fc983af5-d0bd-4185-a518-461dd5b9b953 | 8 | private static void buildToc(Node node, StringBuilder tocNcx, AtomicInteger counter, AtomicInteger playOrder, AtomicReference<String> lastHref, Map<String, Integer> playOrders) {
if (node != null) {
if (node.getNodeType() == Node.ELEMENT_NODE) {
if (node.getNodeName().equals("item"))... |
e162090a-6773-4fe5-add6-b91672962ee5 | 5 | public boolean isEmpty() {
boolean test = false;
if (test || m_test) {
System.out.println("Coordinate :: isEmpty() BEGIN");
}
if (test || m_test) {
System.out.println("Coordinate :: isEmpty() END");
}
return (m_Value != Game.PlayerTurn.PLAYER1 && m_Value !=
... |
9c218272-51c2-4294-b69b-1129764dd251 | 1 | protected void setLine(String line, int index) {
if (index < this.uiFileLines.size()) {
this.uiFileLines.set(index, line);
} else {
addLine(line);
}
} |
53c53312-8e3f-42fe-ae1f-0abf35d11f60 | 1 | public Node popFront() {
Node node = head.next;
if (node == head) {
return null;
} else {
node.unlink();
return node;
}
} |
f7d12bb9-4f10-4280-b2ec-de36d4bc7594 | 7 | public String checkName2(ArrayList<Customer> c)
{
boolean taken = true;
Boolean secondTest = null;
String finalAnswer = null;
String proposedFirst = null;
String proposedLast = null;
while (taken)
{
boolean notFound = true;
System.out.println("Please enter the first name of the customer that you... |
28e53e5a-55e8-457a-a87b-771cde0060a2 | 9 | private void genIfCmpStmt(final IfCmpStmt stmt) {
int opcode;
stmt.visitChildren(this);
genPostponed(stmt);
final int cmp = stmt.comparison();
if (stmt.left().type().isReference()) {
Assert.isTrue(stmt.right().type().isReference(),
"Illegal statement: " + stmt);
switch (cmp) {
case IfStmt.E... |
66435057-849e-419b-8964-227a76f3ca50 | 5 | private static Integer[] hayRepetidos(int[] numeros){
int max = 0;
Vector<Integer> respuesta = new Vector<Integer>();
int[] repeticiones;
for(int n : numeros)
if(n > max) max = n;
repeticiones = new int[max + 1];
for(int n : numeros)
repeticiones[n]++;
for(int i=0; i<repeticiones.length;... |
d33c6399-bf7e-454e-833b-a781bff97757 | 1 | @Override
public int size() {
int allSize = 0;
for (int i = 0; i < 256; ++i) {
allSize += files[i].getSize();
}
return allSize;
} |
842337c1-9961-4188-87af-2890402499cd | 0 | public Dimension getWindowSize() {
return windowSize;
} |
65ec178b-51c1-4d11-be80-f135c4b04352 | 9 | public static void main(String[] args) {
// Present the user with the available options.
System.out.print(menu);
// Read in the user's choice.
String userSelection = null;
int depthLimit = DEFAULT_DEPTH_LIMIT;
userSelection = stdIn.nextLine().trim();
while (!userSelection.equalsIgnoreCase("q")) {
... |
53b30745-aa33-49c7-9213-5d375e6d208c | 1 | public Object invoke(Invocation invocation) {
if(invocation.getMethod().isAnnotationPresent(Transactionable.class)) {
// Save state of Transactionable object.
invocation.storeState();
// Invoking the developper's method.
System.out.println("DEBUG: Invoking " + invocation.getM... |
72dce203-682c-4e91-b927-d5cf79383c19 | 3 | @SuppressWarnings("unchecked")
private static int partition(Comparable[] a, int lo, int hi)
{ // Partition into a[lo..lt-1], a[lt], a[lt+1..hi].
int lt = lo; // partitioning index
int gt = hi; // elements to the right of gt will be greater than the
// pivot
int i = lo;// scanning index
while (i <= gt)... |
bc845003-a615-4299-99c4-56192b5819c1 | 6 | * @return double
*/
public static double base60ToFloat(Cons l) {
{ NumberWrapper dvalue = ((NumberWrapper)(l.value));
NumberWrapper mvalue = ((NumberWrapper)(l.rest.value));
NumberWrapper svalue = ((NumberWrapper)(l.rest.rest.value));
double d = 0.0;
{ Surrogate testValue000 = Stella_O... |
814c84b2-c223-41fc-9eca-94ba182e7fa8 | 4 | public double lowLimNeg() {
double[] helpArray = new double[equationCoef.length];
for (int i = 0; i < equationCoef.length; i++) {
if (equationPower[i] % 2 == 0) {
helpArray[i] = equationCoef[i];
} else {
helpArray[i] = - equationCoef[i];
... |
e8be8f0e-76ef-4d17-b486-741d577cccf7 | 3 | public static boolean unpackFileFromZip(Path zipfile, String filename, Path destDirectory) throws IOException {
boolean ret = true;
byte[] bytebuffer = new byte[BUFFERSIZE];
ZipInputStream zipinputstream = new ZipInputStream(new FileInputStream(zipfile.toFile()));
ZipEntry zipentry;
... |
ca091ece-3a6c-4a03-bf12-e9a1e5211b05 | 5 | public static void main(String[] args) {
Scanner in = new Scanner(System.in);
String input_str;
System.out.println("This program allows you to set the disk colors by overwriting the colors.properties file. " +
"Enter 0 to exit or anything else to continue. ");
... |
752854e1-5f94-4a4c-b41e-3d1429f8d546 | 7 | public void changeNickname(String[] strs){
//input string format (everything inside <> is variable):
//<username>(NAME_CHANGE): <newnickname>
//split input to get user's data
String[] strings1 = strs[0].split("\\(");
String[] strings2 = strs[0].split(": ");
String username = strings1[0];
... |
32e6364e-8a90-483d-8384-37400203aaa2 | 7 | private static Properties readOneConfigurationFile(String filename){
Properties propsFromFile = null;
try {
FileInputStream inputStream = new FileInputStream(filename);
propsFromFile = IO.readUtf8Properties(inputStream);
} catch (Exception e){
System.out.print... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.