method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
d9b9b216-c239-4422-a2e5-bac170e51a30 | 9 | public String simplifyPath(String path) {
if (path.length() < 1)
return "";
StringBuilder curDir = new StringBuilder();
StringBuilder ressb = new StringBuilder();
LinkedList<String> allDirs = new LinkedList<String>();
// Ensure traverse will be terminated by encountering slash
path += '/';
for (int i =... |
dd542ff2-9573-46ef-a697-58a633fcc267 | 3 | @Override
public synchronized void gridletSubmit(Gridlet gridlet, boolean ack) {
int reqPE = gridlet.getNumPE();
try {
if(reqPE > super.totalPE_) {
String userName = GridSim.getEntityName( gridlet.getUserID() );
logger.info("Gridlet #" + gridlet.getGridletID() + " from " +
... |
6dd7fc7a-325d-4c12-abd7-176ddc0d0e7c | 7 | public Command getCommand() {
String inputLine;
String operator = null;
ArrayList<String> captures = new ArrayList<String>();
System.out.print("> ");
inputLine = reader.nextLine();
Scanner tokenizer = new Scanner(inputLine);
if (tokenizer.hasNext()) {
... |
dad0e52c-369d-4411-9286-6bb840fea461 | 3 | private void unflagAllChipsOfColor(int col){
for (int i=0; i<8; i++) {
for (int j=0; j<8; j++) {
if(board[i][j].returnColor() == col)
board[i][j].unflag();
}
}
} |
6139ed10-8b9b-4147-b2c4-5cc13508ec0d | 3 | private void parse_errorDocument( String line,
String keyword,
String[] split,
int lineNumber,
boolean strictMode )
throws ParseException {
// Line has the format:
// "ErrorDocument" <StatusCode> <ErrorDocumentURI>
if( split.length < 3 ) {
throw new ParseException( "In... |
d8827db3-dc84-414b-9778-d786043fd6f9 | 3 | public String toString() {
String write = "Equipped Abilities\n";
int i = 1;
for (Field f : AbilitySet.class.getFields()) {
try {
write += i + ") " + f.getName() + ": " + f.get(this) + "\n";
} catch (IllegalArgumentException e) {
} catch (IllegalAccessException e) {
}
i++;
}
return write;
... |
af8ffed8-3e6f-42d8-9116-624d9d152d58 | 1 | @Override
public void run() // read server messages and act on them.
{
if (ip.isEmpty()) {
doServer();
} else {
doClient();
}
return;
} |
99db0f1a-f36a-4b6d-9323-92570bfbfbb6 | 4 | public static void main(String[] args) {
int playerCount = 2;
int rows = 3;
int cols = 3;
if(args.length == 3){
playerCount = Integer.valueOf(args[0]);
rows = Integer.valueOf(args[1]);
cols = Integer.valueOf(args[2]);
}
if(args.length == 2){
playerCount... |
5a3299a2-e317-4b34-9d8e-8e62d9b20282 | 2 | public void destroySocket(Socket s) {
if (s == null)
return;
if (sockets.contains(s)) {
s.setLinger(linger);
s.close();
sockets.remove(s);
}
} |
ea90112c-b7bc-4174-bd21-d91f67221490 | 8 | private DatasetElement extractData(Data data, boolean calledFromDataArray) {
if(data.isPlain()) {
if(data.getAttributeType() instanceof ReferenceAttributeType) {
String value = data.asReferenceValue().getSystemObjectPid();
if(value.length() == 0) value = "undefiniert";
return new ConfigurationData(data... |
71090f0a-e6ce-430d-9e08-32f5149f66c3 | 0 | public void setSetDoneQuestDTO(List<DoneQuestDTO> setDoneQuestDTO) {
this.setDoneQuestDTO = setDoneQuestDTO;
} |
dcfc1df9-62dc-4321-a217-d33dcac54f65 | 4 | public void distribute(Service provided[]) {
final Batch <Batch <Venue>> allReached = new Batch <Batch <Venue>> () ;
//
// First, divide the set of all venues into discrete partitions based on
// mutual paving connections-
final Tile at = world.tileAt(0, 0) ;
for (Object o : world.presences.ma... |
63a6dc82-522b-44fb-9036-e08ec8cff0b7 | 9 | public DataBag exec(Tuple input) {
try {
DataBag uiWeights = (DataBag) input.get(0);
DataBag uiRecsTemp = (DataBag) input.get(1);
//Create a set of items that the user has already seen.
THashSet<String> seenBefore = new THashSet<String>();
for (Tuple ... |
2a30f1ce-20c2-4039-82ad-ebdc8377c8ce | 3 | public void fix (ArrayList<String> problematic)
{
for (int i=0; i<problematic.size(); i++)
{
String instance = problematic.get(i);
for (int j=i+1; j<problematic.size(); j++)
{
if (instance.equalsIgnoreCase(problematic.get(j)))
{
String checked = problematic.get(j);
problematic.remove(j)... |
b918cf32-e38a-429e-817a-6c4d33963be3 | 7 | private static String getRandomColor(){
String randomColor = null;
switch (getRandomNumber(1, 7)){
case 1:
randomColor = "Red";
break;
case 2:
randomColor = "Orange";
break;
case 3:
random... |
1395c3a8-e424-4fbc-b9a9-d98cd6d15cf2 | 8 | private void load(String resourceName) {
Scanner s = new Scanner(createInputStreamFromResourceName(resourceName));
s.useDelimiter("\r\n");
Scanner ln;
String line;
vertices = new ArrayList<>();
uvs = new ArrayList<>();
faces = new ArrayList<>();
normals =... |
ad9163ee-94a1-45e1-90fb-04c2a810d369 | 7 | public static HashSet<String>[] getAdiacSeed(Graph[] g, Vector<String>[] seed, double densityThresh)
{
HashSet<String>[] adiacSeed=new HashSet[g.length];
int i=0, j=0, k=0;
for(i=0;i<adiacSeed.length;i++)
{
adiacSeed[i]=new HashSet<String>();
for(j=0;j<seed[i].size();j++)
{
HashMap<String,Double> ... |
14d015d6-6496-4a1c-8c9f-62b26bef4e12 | 0 | public SetupGUI() {
initGUI();
} |
690a89af-6c1e-49dd-8292-2e1feb2ebaee | 8 | public boolean readBit() throws IOException {
switch (mNextBitIndex--) {
case 0:
boolean result = ((mNextByte & 1) != 0);
readAhead();
return result;
case 1:
return ((mNextByte & 2) != 0);
case 2:
return ((mNextByte & 4) != 0... |
9f3f4857-8827-40d6-9dbe-58080d6914cd | 8 | private static int count(int[] arr, int m, int n) {
// TODO Auto-generated method stub
int i, j, x, y;
// We need n+1 rows as the table is consturcted in bottom up manner using
// the base case 0 value case (n = 0)
int[][] table=new int[n+1][m];
// Fill the enteries for 0 value case (... |
2ee29999-bf5d-4dd9-8704-81983a76bb2c | 0 | public List findBySource(Object source) {
return findByProperty(SOURCE, source);
} |
3fff21b6-d283-4227-9991-841370909826 | 0 | public ParkDirector() {
} |
2194618b-b88b-4def-8747-2d796bc20efd | 9 | public String createName (ItemStack item, int itemLevel, int rarityLevel, String itemType, String aggAbility) {
String rarity = new String("");
String passiveAbility = new String("");
//String itemTitle = new String("");
String aggressiveAbility = new String("");
if (rarityLevel == 1) {
if (itemLevel... |
de62481b-f90d-4d3d-a9e9-279d2c8d285e | 9 | public static void main(String[] args) throws Exception {
conf = Configuration.fromFile(args[0]);
int threads;
if(args.length > 1 && args[1] != null) {
threads = Integer.parseInt(args[1]);
}
else {
threads = Runtime.getRuntime().available... |
2785273c-70c6-4c40-a210-852a21102dfd | 7 | public static KVArray ReadKVFile(File file) throws KVException
{
try {
KVArray data = new KVArray(); //we will populate this array and return it
reader = new BufferedReader(new FileReader(file));
String line;
currentLine = 0;
//load all lines from the file into the arraylist
while ((line = read... |
e9a514ab-b2f3-4e8e-9f43-5d443efb45e3 | 3 | public boolean importCashPurse(String serverID, String nymID, String assetID, String userInput, boolean isPurse) {
boolean isSuccess = true;
System.out.println("importCashPurse, serverID:" + serverID + " nymID:" + nymID + " assetID:" + assetID);
System.out.println("importCashPurse, userInput p... |
9496414f-7fe4-495c-bda2-2e366e28199f | 8 | @Override
public void executeMsg(final Environmental myHost, final CMMsg msg)
{
final MOB mob=msg.source();
switch(msg.sourceMinor())
{
case CMMsg.TYP_SPEAK:
if((mob.isMine(this))
&&(!amWearingAt(Wearable.IN_INVENTORY))
&&(msg.target() instanceof MOB)
&&(mob.location().isInhabitant((MOB)m... |
91a98d40-6f94-4a06-b623-6994dca40bd0 | 4 | public void unlink() {
synchronized (ui) {
if (next != null)
next.prev = prev;
if (prev != null)
prev.next = next;
if (parent.child == this)
parent.child = next;
if (parent.lchild == this)
parent.lchild = prev;
next = null;
prev = null;
}
} |
9b89aebf-c316-4219-8070-47780ab1b20e | 5 | public void _jspService(HttpServletRequest request, HttpServletResponse response)
throws java.io.IOException, ServletException {
PageContext pageContext = null;
HttpSession session = null;
ServletContext application = null;
ServletConfig config = null;
JspWriter out = null;
Object page ... |
c775f8b2-749e-4f0c-96ce-5c630d368b21 | 4 | public MovingObjectPosition collisionRayTrace(World var1, int var2, int var3, int var4, Vec3D var5, Vec3D var6) {
int var7 = var1.getBlockMetadata(var2, var3, var4) & 7;
float var8 = 0.15F;
if(var7 == 1) {
this.setBlockBounds(0.0F, 0.2F, 0.5F - var8, var8 * 2.0F, 0.8F, 0.5F + var8);
} e... |
b34b6336-2868-4b7c-9c7b-266527ad6112 | 8 | @Override
public void setValueAt(Object o, int row, int col)
{
Order or = info.get(row);
switch (col)
{
case 0 : or.getOrderName(); break;
case 1 : or.getDueDate(); break;
case 2 : or.getSleeve().getMaterial().getName(); break;
case 3 : or.getS... |
3074368b-2743-478e-b5ab-1146aa20d015 | 2 | public void execute() {
long startTime = 0;
long endTime = 0;
LinkedList<Integer> res = null;
//Pre-executions
alg.searchForPattern(searchString, sourceString);
alg.searchForPattern(searchString, sourceString);
for (int i = 1; i <= numberOfExecutions; i++) {
startTime = System.nanoTime(); // get curre... |
dea40277-fac8-43c1-8973-3cc9322d67ed | 5 | public boolean init(String user_name){
username=user_name;
valid_regex=">No such user.<";
valid_pat=Pattern.compile(valid_regex);
urlstr="http://acm.hdu.edu.cn/userstatus.php?user="+username;
try{
url=new URL(urlstr);
in=url.openStream();
read = new InputStreamReader(in,"UTF-8");
br=new BufferedReade... |
da997335-f8f8-4536-bedb-f30e3093d097 | 9 | public Object[] getSelectionCellsForChanges(List<mxUndoableChange> changes)
{
List<Object> cells = new ArrayList<Object>();
Iterator<mxUndoableChange> it = changes.iterator();
while (it.hasNext())
{
Object change = it.next();
if (change instanceof mxChildChange)
{
cells.add(((mxChildChange) chan... |
e5bbdaad-fac7-4454-8de4-1d131b97d70c | 8 | protected void getSubClaimDetail(String title) {
if (title != null) {
for (int i = 0; i < subclaimResultList.size(); i++) {
if (subclaimResultList.get(i).getTitle().equals(title)) {
if (!(subclaimResultList.get(i).getDescription() == null
|| subclaimResultList.get(i).getDescription().equals("null"... |
50c20e5c-c526-431d-bffb-bbbd27503aeb | 7 | public Line(Point p1, Point p2) {
coeff[0] = p2.y - p1.y;
coeff[1] = p1.x - p2.x;
coeff[2] = p1.x * p2.y - p2.x * p1.y;
int d = gcd(gcd(coeff[0], coeff[1]), coeff[2]);
// make sure the first non-zero number is positive
if (coeff[0] < 0 || coeff[0] ... |
d8800bef-d9ad-4033-b5ba-9a724fd9bbee | 5 | public static Individual factory(boolean init)
{
int size = conf.getInt("gene_size");
Class<Individual> clazz = conf.getClass("individual", Individual.class);
Individual newIndv = ReflectiveUtils.newInstance(clazz);
if(init)
{
Gene<?>[] genotype = new Gene<?>[size];
for( int i = 0; i < genotype.len... |
9fc51948-8c73-4698-92d3-7e7eb8233876 | 5 | public void invokeClass(String name, String[] args)
throws ClassNotFoundException,
NoSuchMethodException,
InvocationTargetException {
Class<?> c = loadClass(name);
Method m = c.getMethod("main", String[].class);
m.setAccessible(true);
int mods = m.getM... |
e02639ac-1980-4929-93fd-ca4c140eaf0b | 9 | private static String parseComplexSequence() {
//Go to next non-whitespace character
curChar=peek();
//Is there a '['?
if (curChar=='['){
//Yes, starting with '['! Complex parsing required!
c++;
int squareBracketLevel=1; //square bracket depth level (starting at 1 because there already was '[')
S... |
ad6d4b08-f0a2-44f1-bdeb-c73dc6df8afb | 2 | public static void main(String[] args){
Scanner in = new Scanner(System.in);
int n = in.nextInt();
int k = in.nextInt();
int[] a = new int[n];
for(int i=0;i<n;i++){
a[i]=in.nextInt();
}
int max = maxSum(a);
// System.out.println(max);
findAllC2(n);
for(int i=1;i<=k;i++){
int ans = trySwap... |
1be97df5-fb92-41c0-ad1a-94dcb81b6c09 | 8 | public Expr evaluate(IEvaluationContext context, Expr[] args) throws ExprException {
assertArgCount(args, 1);
if (args[0] instanceof ExprError) {
if (ExprError.NULL.equals(args[0])) {
return new ExprInteger(1);
} else if (ExprError.DIV0.equals(args[0])) {
... |
d17872a7-fab9-43ff-86ee-38c61db65569 | 8 | @SuppressWarnings("unchecked")
public static void main(String[] args) throws IOException {
String path = "E:/workspace/git/LeeCMS/leecms/src/main/webapp/p/common/template10/css/";
String pre="http://www.xslsbj.com/style/";
Collection<File> listFiles = FileUtils.listFiles(new File(path), new String[]{"css"},false... |
abb0e40f-e379-4401-8d41-71c8fc90cf6b | 6 | @EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void onBlockPistonExtend(BlockPistonExtendEvent event) {
if (((Boolean) parent.getConfigu().getOpt(
Config.Option.PistonProtection)).booleanValue()) {
Block b = event.getBlock();
CBlock conBlock = parent.getCBlock(b.getLocation(... |
f15e96da-b48c-4b67-8248-239632b9427c | 5 | StringBuffer generateLayoutCode () {
StringBuffer code = new StringBuffer ();
code.append ("\t\tFillLayout fillLayout = new FillLayout ();\n");
if (fillLayout.type == SWT.VERTICAL) {
code.append ("\t\tfillLayout.type = SWT.VERTICAL;\n");
}
if (fillLayout.marginWidth != 0) {
code.append("\t\tfillLayout.m... |
f5e22db0-8810-4994-b018-511e87f7869d | 6 | public void keyPressed(KeyEvent event) {
// println("You pressed: " + event.getKeyCode() + ", " + event.getKeyChar());
if (event.getKeyCode() == KeyEvent.VK_ESCAPE) {
System.exit(0);
} else if (event.getKeyCode() == KeyEvent.VK_ENTER) {
path.clear();
lab.genNewLab(0, 0);
render();
} else if (event.ge... |
08c7f482-9635-492c-a171-2a0ce75d7436 | 6 | private boolean isPredictableResult()
{
boolean commSet = true;
for (int i = 0; i < 5; i++) {
if (this.communityCards[i] == null) {
commSet = false;
break;
}
}
if (commSet) {
... |
28fa6245-ab6d-4fd6-a9c1-1574624b5cc6 | 7 | public void redrawMap () throws Exception {
if ( map == null )
return;
File img = new File("src/org/yary/realhexgen/images/mapa333.png");
BufferedImage in = ImageIO.read(img);
Graphics g = map.getGraphics();
//g.setColor ( Color.yellow );
... |
ef5478ab-ab77-4410-bf03-ccf312294e39 | 7 | protected void loop() {
boolean looping=true;
while(looping) {
try {
int c=Util.keyPress(String.format(format, num, oob, dont_bundle));
switch(c) {
case '1':
invokeRpcs();
break;
... |
023d00c5-ed5d-4a34-bab8-5a742e5604b2 | 4 | public void updateEntries(List<GuestbookEntryTransferObject> entries) {
// Hide the error label if it's still present.
if (errorLabel.isVisible()) {
errorLabel.setVisible(false);
}
// Update entries in guest entries table.
if (entries != null) {
// Start at +1 offset to skip table heade... |
14e7ec14-abd1-4ab1-97ae-1c8dee31a140 | 5 | private void setDesktopInterface(){
if(ev.getTipeMessage()==Notification.DEFAULT_MESSAGE){
setIconNotify(new ImageIcon(getClass().getResource(config.getNitruxIconsPath()+"NiconDefault.png")));
jlTitle.setForeground(new Color(Integer.parseInt(theme.getTitleForeground(), 16)));
... |
2cc609e5-2bbc-404f-93bd-70c59df58b6c | 2 | public static boolean smallestNum( int x) {
for( int i = 1; i < 20; i++ ) {
if( x % i != 0) {
return false;
}
}
return true;
} |
ed51d971-d197-422b-a613-8850a1374296 | 0 | public static void PrintControls(){
System.out.println();
System.out.println("Controls:");
System.out.println("Up: W");
System.out.println("Down: S");
System.out.println("Left: A");
System.out.println("Right: D");
System.out.println("Shoot: K");
System.out.println();
System.out.println("New game: N");... |
94f97dd6-2ae2-44a2-ad0e-e18d3e60f138 | 8 | protected Term term() throws ParsingException {
Term result;
boolean f = false;
if (tokens[position].equals(Lexeme.LEFT_P.s)) {
position++;
result = term();
} else if (isLowercaseVariable(tokens[position])) {
result = new Term(tokens[position]);
... |
c1de1719-07a9-4d86-be39-897e93859eb6 | 0 | void move() {
System.out.println("Move a Bird");
} |
266ada0c-d07e-44b4-bdde-f0eeecb4ba33 | 3 | private Command getCmdFromIdent(String ident, CommandSender executor) {
ident = ident.toLowerCase();
if(this.identifiers.containsKey(ident)){
return (Command)this.identifiers.get(ident);
}
for(Command cmd : this.commands.values()){
if(cmd.isIdentifier(executor, ident)){
return cmd;
}
}
re... |
d41ee2da-a514-435b-b70d-3695ff0ffa0a | 1 | public void visitArrayLengthExpr(final ArrayLengthExpr expr) {
if (expr.array == from) {
expr.array = (Expr) to;
((Expr) to).setParent(expr);
} else {
expr.visitChildren(this);
}
} |
fb24b751-d2b8-409f-af7a-2d0badd3b489 | 5 | public static void main(String arg[]) {
int count = 0;
for (int i = 1; i < 10; i++) {
switch (i % 4) {
case 0:
case 2:
count += 20 * (int) Math.pow(30, (i / 2 - 1));
break;
case 1:
count += 100 * (int)Math.pow(500, i / 4 -1);
... |
593d42c7-acc4-4e39-80af-6793e191b9a5 | 3 | public static ComplexMatrix zeroMatrix(int rowSize, int colSize) {
// A row size is number of columns
// A column size is number of rows
ComplexMatrix mx = emptyMatrix(rowSize, colSize);
for (int colIndex = 0; colIndex < rowSize; colIndex++) {
for (int rowIndex = 0; rowIndex... |
790a7d83-391a-435a-baf6-b20486973ad3 | 9 | public void update(final Observable obj, final Object arg) {
final String line = (String) arg;
// HighwayModule Module Message
final String nodeIdMain = extractNodeUrn(line);
final VizNode mainNode = displayNode(nodeIdMain);
// Check if node should be ignored
if (mainN... |
4938e908-77f5-4040-b6d9-bfe52945a9a3 | 7 | int[][] method3047(int i, int i_1_) {
anInt9239++;
if (i_1_ != -1564599039)
method3047(8, -86);
int[][] is
= ((Class348_Sub40) this).aClass322_7033.method2557(-108, i);
if (((Class322) ((Class348_Sub40) this).aClass322_7033).aBoolean4035
&& method3090(true)) {
int[] is_2_ = is[0];
int[] is_... |
2f735a4d-dafc-4224-8e10-ac28e61c8cf9 | 6 | public ProcessReturnDialog(ClerkView parent, Controller session) {
setResizable(false);
setTitle("Return Book");
this.parent = parent;
this.mySession = session;
ImageIcon img = new ImageIcon("res/library-icon.png");
this.setIconImage(img.getImage());
setBounds(100, 100, 250, 150);
getContentPane().setLa... |
6adf454b-ebae-4fdc-9d99-ee61d3c58748 | 0 | public void setIdPos(int idPos) {
this.idPos = idPos;
} |
a1db8280-1f40-4963-96b1-2da778ad20fc | 4 | @Override
public void actionPerformed(ActionEvent e) {
String xmlString = "";
//To change body of implemented methods use File | Settings | File Templates.
for (int i = 0; i < buttons.length; i++) {
if (e.getSource() == buttons[i]) {
System.out.println("button is ... |
98066839-6ce0-465a-a6a3-6d42c06e0d99 | 2 | public Gaussian inc() {
if(this.equals(ZERO))
return(ONE);
if(this.a == 1)
return new Gaussian(this.b+2, 0);
else
return new Gaussian(this.a-1, this.b+1);
} |
bfeb425f-43ad-4996-8b9b-c04aca083a02 | 4 | public double pow(double x, int n) {
boolean negative = false;
if (n < 0) {
negative = true;
n = -n;
}
double base = x;
double result = 1.0;
for (; n > 0; n = n >>> 1) {
if ((n & 1) == 1) {
result = result * base;
... |
9a1d6b95-4530-4794-bde0-d3c40b756a89 | 9 | final boolean method2635(byte b) {
anInt9912++;
if (aGLToolkit7197.aBoolean6719 && aGLToolkit7197.aBoolean6738 && aGLToolkit7197.aBoolean6665) {
aClass382_9905 = new Class382(aGLToolkit7197);
aClass169_Sub2_9925 = new Class169_Sub2(aGLToolkit7197, 3553, 34842, 256, 256);
aClass169_Sub2_9925.method1776(fals... |
0da96830-242a-4ce3-a64b-6a75ac4fd6e6 | 7 | public void remove(long l) {
int hash = hashFn(l);
int initialHash = -1;
while (hash != initialHash
&& (table[hash] == DeletedEntry.getUniqueDeletedEntry()
|| table[hash] != null
&& table[hash].getKey() != l)) {
i... |
972c7d06-a672-42b4-a528-2ea61de1f176 | 4 | public static void main(String[] args) {
int nHorses = 7;
int pause = 200;
if (args.length > 0) {
int n = new Integer(args[0]);
nHorses = n > 0 ? n : nHorses;
}
if (args.length > 1) {
int p = new Integer(args[1]);
pause = p > -1 ? p... |
3c72762f-1c66-4590-80eb-24c145018650 | 7 | private void addStone(int x, int y, PlayerColor player) {
Stone newStone = new Stone(x,y,player);
intersections[y][x].setOccupant(newStone);
boolean newStoneIsUnconnected = true;
Set<StoneGroup> oldGroups = new HashSet<>();
oldGroups.add(newStone.getGroup());
for (Intersection i : intersections[y][x].get... |
390b9664-7645-4812-903e-f7b80468e6b1 | 2 | private static XYDataset createDataset()
{
XYSeries actual = new XYSeries("Actual number of comparsions");
XYSeries average = new XYSeries(
"Calculated average number of comparsions - 2N * ln(N)");
for (int k = 100; k <= 10000; k *= 10)
{
Double a[] = new Double[k];
for (int i = 0; i < k; i++)
... |
478d461f-caee-4033-a4ae-bb7fec547dba | 2 | @Override
public String toString() {
String transactionItems = "";
int num = this.transaction.getItemSet().size();
for (int i = 0; i < num; i++) {
String item = this.transaction.getItemSet().get(i).toString();
transactionItems = transactionItems + item;
if (i < num - 1) {
transactionItems = transact... |
27d6dc94-891d-4198-ac01-9bac60af202d | 6 | private void btn_inscribirmeActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btn_inscribirmeActionPerformed
if (getControlador().RegistrarUsuario(txt_nombre.getText(), txt_telefono.getText(), txt_direccion.getText(), txt_contraseña1.getText(), txt_contraseña2.getText())) {
if (txt... |
9f9a1b29-c187-45bd-bfce-54929cea4853 | 0 | public void bsTest(ArrayList<Item> al) {
System.out.println("Begin BS testing---------------------------");
searchAl(al,al.get(528).data2);
} |
c186b47e-de72-4a04-b364-862501da0e85 | 4 | private int jjMoveStringLiteralDfa3_0(long old0, long active0)
{
if (((active0 &= old0)) == 0L)
return jjStartNfa_0(1, old0);
try { curChar = input_stream.readChar(); }
catch(java.io.IOException e) {
jjStopStringLiteralDfa_0(2, active0);
return 3;
}
switch(curChar)
{
case 108:
... |
746a8f5d-7c72-4574-86e0-2f99c5e5596e | 4 | final public CycList notForm(boolean requireEOF) throws ParseException, java.io.IOException, UnsupportedVocabularyException {
CycObject sent = null;
CycList val = new CycList();
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case NOT_CONSTANT:
jj_consume_token(NOT_CONSTANT);
break;
case NOT_GUID_CO... |
25c843b1-2d59-4025-be26-4c45b5f27869 | 7 | public static BigInteger cbrt(BigInteger n) {
BigInteger guess = n.divide(BigInteger.valueOf((long) n.bitLength() / 3));
boolean go = true;
int c = 0;
BigInteger test = guess;
while (go) {
BigInteger numOne = n.divide(guess.multiply(guess));
BigInteger numTwo = guess.multiply(new BigInteger("2"));
gu... |
0030b3c4-54c5-4fa6-9f6f-802642f6fe96 | 9 | public void testRemoveLast() {
ByteArrayBuilder builder = new ByteArrayBuilder();
byte[] testdata = new byte[777];
for(int i=0;i<testdata.length;i++) {
testdata[i] = (byte)i;
}
builder.clear();
for(int i=0;i<testdata.length;i++) {
assertEquals(i, builder.length());
builder.append(testdata[i]);
... |
8e447ed9-053e-4ca5-b3f4-1f26d0c45540 | 2 | @Test
public void testParse() throws Exception {
final ConfigParser cp = new ConfigParser();
cp.parse(new File("tests/sample-config.json"), new ConfigHandler() {
public void config(String name, String remote_addr, int listen_on, String log_dir, Properties[] filter_configs) {
... |
9dde42e8-5778-404a-9e38-c9c98a4ed113 | 4 | public static SelectItem[] getSelectItems(List<?> entities, boolean selectOne) {
int size = selectOne ? entities.size() + 1 : entities.size();
SelectItem[] items = new SelectItem[size];
int i = 0;
if (selectOne) {
items[0] = new SelectItem("", "---");
i++;
... |
f0498068-7c76-4f64-b65e-77dbda7f2abe | 4 | private Pair findFirstNonzeroColumn(int i, int j){//in column j after i-1
Pair p=new Pair(-1,j);
int k=i;
if (j>=rows){
p.x=i;
p.y=-2;
return p;
}
while (elements[k][j]==0){
if ((k+1)<rows) k++;
else break;
}
... |
74e0c782-cc6f-401d-ada2-ce426b95246e | 2 | public CloseButton(Environment environment)
{
super();
setDefaults();
env = environment;
env.addChangeListener(new ChangeListener()
{
public void stateChanged(ChangeEvent e)
{
checkEnabled();
}
... |
a65f0ae8-ec9b-466f-b88a-bac589a766bc | 9 | @Override
public BasicValue newValue(final Type type) {
if (type == null) {
return BasicValue.UNINITIALIZED_VALUE;
}
boolean isArray = type.getSort() == Type.ARRAY;
if (isArray) {
switch (type.getElementType().getSort()) {
case Type.BOOLEAN:
... |
b09af028-4257-43ef-8b44-5d0ad635d926 | 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... |
d4203bf5-9ef8-4c46-bd20-ce469fadfc0f | 8 | private void parse() throws MalformedUriException {
int pos;
String string = this.string;
if (!schemeValidationPattern.matcher(string).find()) {
throw new MalformedUriException(string, "invalid scheme");
}
if ((pos = string.indexOf('#')) >= 0) {
fragment ... |
da82f681-b472-4961-bc51-04bd02bcb8f4 | 5 | private void validateRequest(Request request) {
if (request == null) {
throw new BeanstalkException("null request");
}
String command = request.getCommand();
if (command == null || command.length() == 0) {
throw new BeanstalkException("null or empty command");
}
String[] validStates = request.getVal... |
c30212c8-3472-4793-ac1f-f5ead336ab67 | 3 | public static void getFiles(File f) {
File files[];
if(f.isFile()) {
String path = f.getAbsolutePath();
try {
getNames(path);
System.out.println(path);
}
catch(Exception e) {
System.out.println("ERROR!!! " + path);
}
... |
63ca9e94-af67-4832-8f70-7a8a3a3eeeeb | 5 | public String getJavaName() {
/*
* Don't load attributes for class names not containing a dollar sign.
*/
if (name.indexOf('$') == -1)
return getName();
if (getOuterClasses() != null) {
int last = outerClasses.length - 1;
StringBuffer sb = new StringBuffer(
outerClasses[last].outer != null ? o... |
baf0389f-5abf-426c-8665-14c9f057bdea | 1 | @Test
public void WhenFailedPath1_ExpectHostWithPrefix001() throws UnknownHostException {
// localhost: "000"
// failed: "1"
// resulted prefix: "001"
RoutingTable routingTable = new RoutingTable();
Host localhost = new PGridHost("127.0.0.1", 3000);
localhost.setHostP... |
45c8c5d0-9e61-499a-97e4-25aff6e07713 | 5 | public String execute(){
LibraryManagementFacade facade = new LibraryManagementFacade();
String retValue = SUCCESS ;
if(getSubmit() != null && SUBMIT.equals(getSubmit())) {
try {
setStudentVO(facade.updateStudent(getStudentVO()));
if(studentVO != null){
this.setId(getStudentVO().getId());
ad... |
c395834f-6f1d-4e8c-883d-1daa2f512ccc | 4 | public static <A> F<Reader, F<IterV<Character, A>, IO<IterV<Character, A>>>> charChunkReader2() {
final F<IterV<Character, A>, Boolean> isDone =
new F<Iteratee.IterV<Character, A>, Boolean>() {
final F<P2<A, Input<Character>>, P1<Boolean>> done = constant(P.p(true));
final F<F<Input<Character>... |
1d21265e-a8e7-426d-95e2-006c52c5241f | 4 | public static Collection<File> getTMXFiles(File directory) {
if (!directory.isDirectory()) return Collections.emptyList();
List<File> ret = new Vector<File>();
for (File f : directory.listFiles()) {
if (f.isDirectory()) {
ret.addAll(getTMXFiles(f));
} el... |
f98ae9c6-371e-40bd-98cb-8eeb4bf8f525 | 2 | public void draw(Vector2f camera) {
// Sprite Size size of a full tile
// Inhabits of full tile, activated by "E" press in a short radius around it
// state 1 = not flipped, state 2 = flipped
float tempX = getX();
float tempY = getY();
// These numbers setup the sprite accordingly (even though its -38... |
35a9248e-8bd7-4dc9-a1a8-fd3c5c84df08 | 1 | @Test
public void testGlobalHandlers() {
EasyFlow<StatefulContext> flow =
from(START).transit(
on(event_1).to(STATE_1).transit(
on(event_3).to(START)
),
on(event_2).to(STATE_2).transit(
... |
28cecdac-e782-4128-843f-778109365a29 | 3 | private boolean isEnPassant( Move move ) {
return ( ( Math.abs( move.to() - move.from() ) == 17 || Math.abs( move.to() - move.from() ) == 15 ) && squareEmpty( move.to() ) && isPawnMove( move ) );
} |
22f0c7d0-b587-400e-9eb7-baa8ccbe4ee5 | 3 | public Player getPlayer(String s){
if(!isCommonName(s)){
for(int i=0; i < this.size(); i++){
if(this.get(i).getName().startsWith(s)){
return this.get(i);
}
}
}
return null;
} |
5c82ee7c-9efd-45ab-a139-5a40b3b55096 | 8 | public static void main( String[ ] args ) throws IOException {
BufferedReader in = new BufferedReader( new InputStreamReader( System.in ) );
String line = "";
StringBuilder out = new StringBuilder( );
HashMap<Character,Character> list= new HashMap<Character, Character>( );
HashMap<Character,Character> listInv... |
14c08283-677a-42ab-a8e5-91951a39edd0 | 0 | @RequestMapping(value = "/", method = RequestMethod.GET)
public ModelAndView welcome() {
return new ModelAndView("welcome");
} |
90435eed-9039-48bd-8a1a-ed0d9c34571b | 4 | @Override
public boolean equals(Object that) {
if (this == that) {
return true;
}
if (that == null) {
return false;
}
if (getClass() != that.getClass()) {
return false;
}
if (id != null) {
return id.equals(((UserBE) that).id);
}
return super.equals(that);
} |
796d547d-107e-4232-8785-cfb2a4f8074d | 7 | protected void exportDone(JComponent c, Transferable data, int action) {
JList<?> source = (JList<?>) c;
if (!source.getName().equals("conditionsList")) {
DefaultListModel<?> listModel = (DefaultListModel<?>) source.getModel();
if (action == TransferHandler.MOVE) {
for (int i = indices.length - 1; i >= 0... |
05a90d8b-edba-4dab-a4d2-4bff596f8545 | 1 | public void displayGui(Gui gui){
if(gui != null){
isDisplayingGui = true;
guiDisplaying = gui;
}
else{
isDisplayingGui = false;
guiDisplaying = null;
displayGui(new GuiHud(this, player));
}
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.