method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
b081938e-5e7a-464d-bd20-8e68081e8562 | 7 | public void afficher_horsligne(boolean ajouter, int val_date) {
int i,premier_message, dernier_message;
if (ajouter==true) {
date_hl_encours += val_date;
}
else {
date_hl_encours = val_date;
}
slider.setValue(date_hl_encours);
val_S.setText(Integer.toString(date_hl_encours/1000));
val_ms.setText... |
23fbed79-0611-4dac-8f62-38148023b399 | 9 | public static Orientation fromValue(int value) {
switch (value) {
case 1:
return NORMAL;
case 2:
return NORMAL_FLIPPED;
case 3:
return NORMAL_ROTATED_180;
case 4:
return NORMAL_FLIPPED_ROTATED_180... |
4904a1b2-111e-4e36-b857-84efca891390 | 7 | protected boolean checkFaceConvexity(Face face, double tol, PrintStream ps) {
double dist;
HalfEdge he = face.he0;
do {
face.checkConsistency();
// make sure edge is convex
dist = oppFaceDistance(he);
if (dist > tol) {
if (ps != nul... |
0103c4bf-a05c-4596-8676-2becbe2a1c0a | 6 | @Override
public void setColorDrawing(ColorKey key) {
this.colorDrawing = key;
if(this.colorDrawing == ColorKey.BEPAINT_BLACK) {
this.lineData.setColor(Color.black);
this.shapeData.setColor(Color.black);
} else if(this.colorDrawing == ColorKey.BEPAINT_BLUE) {
this.lineData.setColor(Color.blue);
th... |
eff47ecf-72d4-462f-88d6-f2e386c79641 | 6 | public boolean RequiredMet() {
return (EnemiesMet() || !EnemyPrimary)
&& (PointsMet() || !PtsPrimary)
&& !(!EnemyPrimary && !EnemyPrimary && !PtsPrimary);
} |
fa14335d-b949-4643-b177-a4e53d77ada2 | 7 | public void drawFunction(WindowAndDataProvider windowAndDataProvider, Graphics g, double domainLeft, double domainRight)
{
if(visible == true)
{
DPoint p1, p2;
int j1, j2;
p1 = new DPoint();
p2 = new DPoint();
g.setColor(color);
j1 = 0;
while(points.ge... |
841045ff-6f19-4824-b6f2-897797e7cf95 | 7 | public static boolean NTclassMemberList() throws IOException {
boolean success = true;
success = ErrorRecovery(NonTerminal.classMemberList);
switch (lookahead) {
case INTEGER:
case REAL:
case ID:
if (!NTclassMember())
success = false;
if (!NTclassMemberList())
success = false;
if (success)... |
772164b2-753c-4c16-9e52-1327daec1399 | 3 | public void draw(Graphics2D g) {
bg.draw(g);
tileMap.draw(g);
player.draw(g);
for (int i = 0; i < enemys.size(); i++)
((Enemy) enemys.get(i)).draw(g);
teleport.draw(g);
for (int i = 0; i < explosions.size(); i++) {
((Explosion) explosions.get(i)).setMapPosition((int) tileMap.getx(), (int) tileMap.gety... |
f982157c-75af-4f9b-88d0-3d78d15303e6 | 7 | * @return Keyword
*/
public static Keyword computeDayOfWeekJulian(int julianDay) {
switch ((julianDay % 7)) {
case 0:
return (Stella.KWD_MONDAY);
case 1:
return (Stella.KWD_TUESDAY);
case 2:
return (Stella.KWD_WEDNESDAY);
case 3:
return (Stella.KWD_TH... |
b403f72b-13c1-41f9-8840-38ad5dcf0c59 | 4 | public Transition addLabelToOutgoingTransition(Transition t, String label) throws Exception, NoSuchTransitionException{
if(outgoingTransitions.contains(t)) {
for (Transition trans : outgoingTransitions) {
if(trans == t)
continue;
if (trans.get... |
bbe4dfa8-7f53-420e-9b18-7e007bb42628 | 2 | protected void prepareAttributes(GrowableConstantPool gcp) {
if (unknownAttributes == null)
return;
Iterator i = unknownAttributes.keySet().iterator();
while (i.hasNext())
gcp.putUTF8((String) i.next());
} |
7aa79de9-fb9f-449e-93d7-ac427d99060c | 2 | private HttpResponse getJMX(String url) {
BmLog.debug("Requesting : " + url);
HttpGet getRequest = new HttpGet(url);
getRequest.setHeader("Connection", "keep-alive");
getRequest.setHeader("Host", BmUrlManager.SERVER_URL.substring(8, com.blazemeter.jmeter.api.BmUrlManager.SERVER_URL.lengt... |
4c76a6f0-be51-47dc-b5ce-f9b46a16891e | 5 | public void renameClass(String oldName){
for (int i=0;i<components.size();i++){
if (components.get(i).name.equals(oldName)){
String newName =
JOptionPane.showInputDialog("Enter Class Name:");
for (DragAndDropClassObject classObject:components){
for(Link link:classObject.links){
if (link.cl... |
e74be7e4-b325-4639-ae4e-709e804fdfd8 | 6 | @Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
Album other = (Album) obj;
if (id == null) {
if (other.id != null)
return false;
} else if (!id.equals(other.id))
return false;
ret... |
227988a8-1b87-4f94-9388-f7cae5df28b9 | 5 | public static ArrayList<String> getFilesInFolder(String folder) {
if (jarLocation != null) {
ArrayList<String> list = new ArrayList<String>();
for (String s : files) {
if (s.startsWith(folder))
list.add(s);
}
return list;
} else {
String[] list = new File(nonJarResourceFolder + folder).list(... |
faf32e9c-b102-478a-a309-0558de8436f8 | 1 | public void testConstructor_ObjectLocalDate() throws Throwable {
LocalDate date = new LocalDate(1970, 5, 6);
try {
new LocalDateTime(date);
fail();
} catch (IllegalArgumentException ex) {}
} |
48780f25-ef04-406b-a8b2-a07e663c8a3f | 9 | private void testAbstractMethods(ByteMatcher matcher) {
// test methods from abstract superclass
assertEquals("length is one", 1, matcher.length());
assertEquals("matcher for position 0 is this", matcher, matcher.getMatcherForPosition(0));
try {
matcher.getMatcherForPositio... |
8826ceaf-5b8c-4229-a72b-fb75c3ac8051 | 0 | @Override
public void paintComponent(Graphics g) {
super.paintComponent(g);
doDrawing(g);
} |
3615d033-fef1-423b-a128-6ac38850052d | 0 | @Override
public String introduceYourself() {
return "FieldQuest";
} |
1b433c1f-108f-430d-9a2a-4595750ba244 | 1 | public void clearButtons() {
while(cur > 0) {
buttons[cur].setVisible(false);
cur--;
}
buttons[0].setVisible(false);
} |
e93c5a4e-4a33-4e73-bab3-eb6e65af68bb | 3 | public Expression combine(CombineableOperator comb) {
Operator combOp = (Operator) comb;
if (comb.lvalueMatches(this)) {
/* We already checked in canCombine that subExpressions match */
comb.makeNonVoid();
combOp.parent = parent;
return combOp;
}
for (int i = 0; i < subExpressions.length; i++) {
... |
675d7bbe-57cd-4ed3-b355-f5c3622f0609 | 2 | public boolean canFinish(int[] gas,int[] cost, int start){
int length = gas.length;
int tank =0;
for(int i =0 ;i< length;i++){
tank = tank + gas[i%length] -cost[i%length];
if(tank < 0)
return false;
}
return true;
} |
8e0c4602-ee3d-4718-8787-1e39cf2e5bc3 | 9 | public void updateSavingReqBunch(
Map<AbstractPage, List<ProgressReportStruct>> map, JTree tree) {
boolean needsRefresh = false; // flag to repaint this node (relatively long operation)
Long value = null;
try {
value = map.get(page).get(0).value; // for every page CheckSavingJob reports exactly one time... |
82bd078b-bb5d-4509-9b36-b0ec30a6a447 | 3 | public void readFully(byte b[]) throws IOException {
int len = b.length;
if (len < 0)
throw new IndexOutOfBoundsException();
int n = 0;
while (n < len) {
int count = read(b, n, len - n);
if (count < 0)
throw new EOFException();
... |
6c67856f-ad74-41b9-9982-7483ec1daaf9 | 7 | private void initialize()
{
TreeParent root = null;
if (data == null)
{
root = new TreeParent("No results", 0);
}
else
{
root = new TreeParent("Results", 0);
HashMap<Integer, TreeParent> hashMap = new HashMap<>();
for (Tuple tuple : data)
{
if (tuple.count >= 2)
{
... |
55f9edc2-15a0-49eb-8341-6f05510eabb9 | 6 | private static String cleanUpMediaSizeName(MediaSizeName msn) {
StringBuilder builder = new StringBuilder();
StringTokenizer tokenizer = new StringTokenizer(msn.toString(), "- ", true); //$NON-NLS-1$
while (tokenizer.hasMoreTokens()) {
String token = tokenizer.nextToken();
if (token.equalsIgnoreCase("na")... |
6d67a698-8e2e-4db0-958b-9ac75c2f77e7 | 4 | public static void printNumber(Object[] mass)
{
for(Object a:mass)//проходим по элементам одномерного массива
{
if(a instanceof Integer && (Integer) a%3==0)
//если элемент является числом и делиться на 3, то выводимего
System.out.println(a);
if(a instanceof Object[])
//если элеме... |
979c27f0-8f5e-4e28-9de9-7dbdceef31fa | 2 | @Override
public void dropBomb() {
if (canBomb()) {
bombs--;
int timer = 0;
for (int i = 0; i < match.bombTimerDice; i++) {
timer += Math.random() * match.bombTimerSides + 1;
}
tile.putBomb(new Bomb(timer, this, tile));
}
... |
3932dddb-0da6-45d6-990a-0c9dd0fc1eb6 | 9 | public static int search(int[] a, int target) {
if (a == null || a.length == 0) {
return 0;
}
int left = 0;
int right = a.length - 1;
while (left <= right) {
int middle = (left + right) / 2;
if (a[middle] == target) {
return mi... |
1eb0b5a6-d283-4bfb-83aa-e18d787fd514 | 9 | public static boolean checkAllValues(Object[] values){
boolean correct = true;
for(Object value : values){
if(value == null)
continue;
if(!(value instanceof Integer) &&
!(value instanceof Double) &&
!(value instanceof String) &&
!(value instanceof Character) &&
!(value instanceof F... |
f0df9a3a-082b-4d7f-a631-d9794c88c8fb | 9 | public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
PrintWriter out = response.getWriter();
RequestDispatcher dispatcher;
DBC dbc = new DBC();
User u = new User(dbc,request);
int pid=0;
if(!u.isLogged... |
ff675af9-0ac4-4fb6-929c-3b4ffe20daa9 | 4 | @Override
public void setBlockBoundsBasedOnState(IBlockAccess var1, int var2, int var3, int var4) {
TileEntityPiston var5 = this.getTileEntityAtLocation(var1, var2, var3, var4);
if(var5 != null) {
Block var6 = Block.blocksList[var5.getStoredBlockID()];
if(var6 == null || var6 == this) {... |
b5c68f38-6060-4ca0-924c-0fa9593c7e60 | 3 | public void searchLoL() {
try {
BufferedReader LAWL = null;
String Folder = null;
File Paath = new File("Path");
if (Paath.exists()) {
LAWL = new BufferedReader(new FileReader("Path"));
Folder = LAWL.readLine();
File file = new File(Folder);
if (file.exists()) {
this.leagueOfLegendsBa... |
c0835a6a-c86e-409c-8f5c-c6909cc06bfe | 6 | public String extract(String path) {
String art = null;
try {
Mp3File mp3 = new Mp3File(path);
ID3v2 tag = mp3.getId3v2Tag();
if (tag != null) {
String mimeType = tag.getAlbumImageMimeType();
byte[] rawImage = tag.getAlbumImage();
... |
99d64e4e-0cc5-4cdc-872a-4ec6a19f0cfc | 3 | private void clickedConfirm()
{
String phr1 = panelTop.getText();
String phr2 = panelBot.getText();
if (phr1 != null && phr2 != null)
{
panelTop.clear();
panelBot.clear();
Phrase.createNew(coach.getCon(), Integer.parseInt(frameDictionary.getID()), type, phr1, phr2);
if (tabOrder != null)
t... |
6aa12a5b-20a0-48e3-9cc3-e681be2a5e11 | 4 | private List<HantoMoveRecord> getPossMoves(List<HantoCell> openCells){
List<HantoMoveRecord> possibleMoves = new ArrayList<HantoMoveRecord>();
List<HantoCell> boardPieces = new ArrayList<HantoCell>();
if (gameManager.getCellManager().getPlayerCells(myColor) != null){
boardPieces.addAll(gameManager.getCellManag... |
a3398281-122f-4377-b2ba-faaccee13325 | 9 | public void draw(UShape ushape, double x, double y, ColorMapper mapper, UParam param, Graphics2D g2d) {
final UEllipse shape = (UEllipse) ushape;
g2d.setStroke(new BasicStroke((float) param.getStroke().getThickness()));
visible.ensureVisible(x, y);
visible.ensureVisible(x + shape.getWidth(), y + shape.getHeight... |
537d11ae-a17e-4df9-8895-33e618d1fb92 | 8 | public static RoomInfo getRoomInfoFromJson(JSONObject obj)
{
if(obj==null)
return null;
RoomInfo roomInfo=new RoomInfo();
Object value=null;
JSONArray teams=null;
JSONObject tmpObj=null;
Team tmpTeam = null;
value = obj.get("id_room");
if(value!=null)
{
roomInfo.setId_room(value.toString(... |
f2d80338-21f9-4a00-b31e-53b93cb692c4 | 4 | @Override
public Object getValueAt(int i, int i1) {
SimpleMeal retrievedSimpleMeal = mealList.get(i);
switch (i1) {
case NAME_COLUMN:
return retrievedSimpleMeal.getName();
case CALORIES_COLUMN:
return retrievedSimpleMeal.getCalories();
... |
3e3e9203-2d48-48ab-b4f3-5b82ffc89069 | 0 | public int getWidth(){
return width;
} |
0b5c8b65-c3a8-4d4f-90b2-7fc3fbaf3f30 | 3 | public void PrintTileNumbers(PrintWriter w)
{
w.println(tileRow + ", " + tileCol + ", " + numOfTiles + ", " + fileName);
for (int i = 0; i < tileRow; i++)
{
for (int j = 0; j< tileCol; j++)
{
Tile temp = tiles[i][j];
if(temp.GetTileNum() != -999)
{
w.print(tem... |
78bfddd8-62ea-4899-920a-9cd1b7e5ec0d | 7 | Bond[] addToBonds(Bond newBond, Bond[] oldBonds) {
Bond[] newBonds;
if (oldBonds == null) {
if (numCached[1] > 0)
newBonds = freeBonds[1][--numCached[1]];
else newBonds = new Bond[1];
newBonds[0] = newBond;
}
else {
int oldLength = oldBonds.length;
int newLength = oldLength + 1;
if (newLen... |
d61e6c24-de6d-4bb0-a5b5-525a65a294fa | 5 | public boolean equals(Object obj) {
if (obj == null) {
return false;
}
if (!(obj instanceof SRPPrivateKey)) {
return false;
}
SRPPrivateKey that = (SRPPrivateKey) obj;
boolean result = super.equals(that) && X.equals(that.getX());
if (v != null) {
resu... |
06820b07-dc7c-43d6-aa03-b26b1e522899 | 5 | public static final String truncateIfNecessary(String text, int count, int truncationPolicy) {
int tCount = text.length();
count = tCount - count;
if (count > 0) {
count++; // Count is now the amount to remove from the string
if (truncationPolicy == SwingConstants.LEFT) {
return ELLIPSIS + text.substri... |
ab972ca1-6719-4517-9468-3affb11fb922 | 7 | public String state3Con()
{
String pref = prefCon();
if(validWifi()&&(getScreen() == 1 || getScreen() == 3))
{
String currentCon;
if(baseCon!=null)
currentCon = baseCon.getPartnerName();
else if(remCon != null)
currentCon = remCon.getPartnerName();
else
return pref;
if(currentCon.equa... |
4a66f0c5-62ec-4556-8fd7-06c19afd8eb1 | 9 | public static void event(Piece piece, Board board)
{
int event = board.getRandom(1, 19);
// GET PAID event * 100
if(event > 0 && event < 6)
{
piece.addMoney(event*100);
}
// TELEPORT
else if(event == 7)
{
event = board.getRandom... |
bce46721-8a1e-4f90-bda6-bb0314604a23 | 3 | public boolean equals(Object o) {
if (this == o)
return true;
if (!(o instanceof Operator))
return false;
Operator other = (Operator) o;
return opEquals(other) && subsEquals(other);
} |
aabacb61-e278-4ed0-9bfe-5b5a70804111 | 9 | private void fecha_facturaFocusLost(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_fecha_facturaFocusLost
habilitarConfirmar1();
boolean es_componente=false;
if (evt.getOppositeComponent() != field_nro_cliente){
//voy a preguntar si la componente que me saco el foco es algun campo... |
3168a74c-92be-452c-9b53-35caecb509da | 5 | public CodeMap3x set(final int index, final int value) {
final int i0 = index >>> 22;
int[][] map1;
if (i0 != 0) {
if (map == null)
map = new int[MAX_INDEX_ZERO][][];
map1 = map[i0];
if (map1 == null)
map[i0] = map1 = new int[MAX_INDEX_ONE][];
} else
map1 = map10;
final int i1 = (index >... |
4422a19c-2581-4d74-924c-3e22fd375331 | 1 | private JTextField getJTextField0() {
if (jTextField0 == null) {
jTextField0 = new JTextField();
}
return jTextField0;
} |
5d3213b5-1534-4abb-94fc-387988c3ebb8 | 4 | public ChangeType[] getChanges() {
ChangeType[] output = new ChangeType[changes.size()];
int index = 0;
for (ChangeType type : changes) {
switch(type) {
case DISCONNECT_KICK:
case DISCONNECT_TIMEOUT:
case DISCONNECT_QUIT:
return new ChangeType[] {type};
default:
output[index++] = type... |
0f0e8301-3be3-4481-851d-96ea8234b230 | 4 | public void GetElementsOnProject(Project project){
try{
SetOfElements projectElements = new SetOfElements();
ResultSet projectResults = null;
Statement statement;
statement = connection.createStatement();
... |
9e6f8068-e8e1-4be3-95d8-7c37319b3fe1 | 1 | public Error(int _type,int _LineNo,int error_code,String _extras){
type=_type;
LineNo=_LineNo;
ErrorManager em=new ErrorManager();
if(em.ErrMessages.containsKey(error_code))
message=em.ErrMessages.get(error_code);
else
message="Unknown Error/Warning... |
aa72017f-62bc-4367-b52e-e74963dc7b79 | 9 | public void randomFunction(){
int red = (int)(Math.random()*3);
if(red == 0){
redNode = new Sin((int)(Math.random()*8+4));
}
else if(red == 1){
redNode = new Cos((int)(Math.random()*8+4));
}
else if(red == 2){
redNode = new Average((int... |
b8751f63-ea53-490d-834e-cf253e7f815c | 7 | public String toString() {
StringBuffer result;
int i;
result = new StringBuffer();
// title
result.append(this.getClass().getName().replaceAll(".*\\.", "") + "\n");
result.append(this.getClass().getName().replaceAll(".*\\.", "").replaceAll(".", "=") + "\n\n");
if (m_Citers == n... |
8be41092-8813-41c7-bbf1-7818bfeed1b1 | 6 | public static void maxHeapifyNonRecursive(int[] x, int index, int len) {
int largest = index;
while (largest == index) {
int left = index << 1;
int right = (index << 1) + 1;
if (left <= len - 1 && x[index] < x[left]) {
largest = left;
}
... |
30181460-4583-4296-b3fe-5d98dd31f679 | 9 | public boolean relaxedEquals(TraceDifference diff) {
if (this.activities.size() != diff.getActivities().size()) {
return false;
}
if (!this.fromNode.equals(diff.getFromNode())) {
return false;
}
if (this.toNode == null || diff.getToNode() == null) {
if (!(this.toNode == null && diff.getToNode() ==... |
f97c7e58-1280-4625-a353-12f3dfa0b694 | 0 | public int getB() {
return this.b;
} |
6e6f6eb3-2852-418c-9778-e36d09dae4c2 | 3 | public Object getTransferData(DataFlavor flavor)
throws UnsupportedFlavorException {
if(!isDataFlavorSupported(flavor))
throw new UnsupportedFlavorException(flavor);
Card[] cards = new Card[nodes.length];
for (int i = 0; i < no... |
d9bc16da-8cdb-49f2-93b0-42f4741a3bbf | 2 | public static int stringSearcher(String[] arr, String val) {
int match = -1;
for (int i = 0; i < arr.length; i++) {
if (arr[i].equalsIgnoreCase(val)) {
match = i;
break;
}
}
return match;
} |
6e5da474-2645-4cf7-93fb-74271e83da1e | 6 | protected Color getHiBorderColor(int tabIndex) {
Color backColor = tabPane.getBackgroundAt(tabIndex);
if (tabIndex == tabPane.getSelectedIndex()) {
if (backColor instanceof UIResource) {
return AbstractLookAndFeel.getControlHighlight();
} else {
re... |
9842b8c2-09a1-4c64-9037-f1bfedbe2bb3 | 4 | @Override
public boolean contains(int x, int y) {
x = x - centersdeviation;
y = y - centersdeviation;
double a = Math.sqrt((x - x1) * (x - x1) + (y - y1) * (y - y1));
double b = Math.sqrt((x - x2) * (x - x2) + (y - y2) * (y - y2));
double c = Math.s... |
f730b263-1162-41d3-8833-7207f83054aa | 4 | public boolean add(Debate debate) {
// Get root element
Element debateE = document.getRootElement();
// Adding user elements and attribute 'username'
Element debateElement = debateE.addElement("debate").addAttribute(
"id", debate.getId());
// Add child elements
debateElement.addElement("id").setText(deb... |
9ce0a792-a1c8-4bd3-8593-17b004b287bf | 1 | private CtField compileField(FieldDecl fd)
throws CompileError, CannotCompileException
{
CtFieldWithInit f;
Declarator d = fd.getDeclarator();
f = new CtFieldWithInit(gen.resolver.lookupClass(d),
d.getVariable().get(), gen.getThisClass());
f.se... |
fc13d00f-292d-44d3-831b-7584d8950670 | 4 | public SQLite(Logger log, String prefix, String name, String location) {
super(log,prefix,"[SQLite] ");
this.name = name;
this.location = location;
File folder = new File(this.location);
if (this.name.contains("/") ||
this.name.contains("\\") ||
this.name.endsWith(".db")) {
this.writeError("The dat... |
d15350b7-5c8c-41d0-a1ca-8647fdec17a5 | 1 | @Override
public int print(Graphics g, PageFormat pf,
int page)
throws PrinterException {
// We have only one page, and 'page'
// is zero-based
if (page > 0) {
return NO_SUCH_PAGE;
}
// User (0,0) is typically outside the
// imageable area, ... |
208eacf1-ee7c-4b72-b648-b484ec5249e3 | 9 | @Override
public Textifier visitMethod(final int access, final String name,
final String desc, final String signature, final String[] exceptions) {
buf.setLength(0);
buf.append('\n');
if ((access & Opcodes.ACC_DEPRECATED) != 0) {
buf.append(tab).append("// DEPRECATED\... |
422b7b7a-8a78-410b-871a-180d6a18bb2f | 7 | public String getImageMapAreaTag(
ToolTipTagFragmentGenerator toolTipTagFragmentGenerator,
URLTagFragmentGenerator urlTagFragmentGenerator) {
StringBuffer tag = new StringBuffer();
boolean hasURL = (this.urlText == null ? false
: !this.urlText.equals(""));
... |
66e61905-9c37-4de7-8edc-eba54d181cc7 | 8 | public void setColorByProperty(String property, Color color) {
switch (property) {
case LINE_NUMBER_COLOR:
this.lineNumberColor = color;
break;
case LINE_NUMBER_PANEL_COLOR:
this.lineNumberPanelColor = color;
break;
case WHITESPACE_COLOR:
t... |
a43d6fb4-4369-4069-88a3-c18c4b400a2f | 5 | public synchronized void setTime(long granulePosition) throws IOException {
int page=0;
for(page=0; page<granulePositions.size(); page++) {
Long gp=(Long)granulePositions.get(page);
if(gp.longValue()>granulePosition) {
break;
}
}
pageIndex=page;
cur... |
3621b798-66cb-4a2e-8f3b-f1c40e8e3b95 | 7 | public ArrayList<GeoRefData> loadData () throws IOException {
DataInputStream in = null;
try {
for(String archive : this.archives) {
String strLine;
FileInputStream fileInputStream = new FileInputStream(this.directory + "/" + archive);
in ... |
3ca724af-4fc2-4f26-84c8-d35875da5014 | 4 | @Override
public void execute() {
seq(new EflSelectPcMonOperationSegment(PC_MON_WITHDRAW));
seqSample(() -> {
int numMons = curGb.readMemory(0xDA80);
for (int i = 0; i < numMons; i++) {
int curMon = curGb.readMemory(0xDA80 + i + 1);
if (curMon == mon) {
monGoalPosition = ... |
3a771dc0-f3b9-4cbe-bb75-b502e7b87262 | 6 | public Polynomial addPolynomials(Polynomial p2){
Polynomial polySum = new Polynomial();
int x, y;
PolyNode tempNode1 = this.firstNode;
PolyNode tempNode2 = p2.firstNode;
while(tempNode1 != null && tempNode2 != null){
if(tempNode1.getExponent... |
b42f7136-97e0-4085-a9b3-8a2c6f62986d | 6 | public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
//Все вводится через консоль, команды такие же как и в интерфейсе
//Можно использовать String[] args, и парсить ввод, вводить размер массива не требуется, он расширяется
System.out.println("Введите название класса CircleQueue или Arra... |
946639a7-caf7-472f-878f-60e9b91abfb1 | 2 | @BeforeClass
public static void setUp() {
board = new Board();
try {
board.loadConfigFiles("CR_ClueLayout.csv", "CR_ClueLegend.txt");
} catch (IOException e) {
e.printStackTrace();
} catch (BadConfigFormatException e) {
e.printStackTrace();
}
} |
e1f8a58f-dcce-4f8a-b89a-1d00b8dc2732 | 6 | @Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
Room other = (Room) obj;
if (cost != other.cost)
return false;
if (id != other.id)
return false;
if (size != other.size)
return fals... |
fb03ff66-7b86-448b-ae08-b5f6589af442 | 3 | @Override
public void recreate() {
try {
if (formula == null)
formula = new String[] { "0" };
setFormula(formula);
} catch (ConnectException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (ParseException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
... |
c443095d-9266-4e65-bdd1-cbad3ce915ca | 0 | public void setEndTime(Date endTime) {
this.endTime = endTime;
} |
f02e00b6-677e-4fc5-ad03-ca6a476efb47 | 8 | public void loadSystem() {
chooser.setDialogTitle("Open");
String p = prefs.get("filechooser", null);
if (p != null) {
chooser.setCurrentDirectory(new File(p));
}
int resp = chooser.showOpenDialog(this);
if (resp == JFileChooser.APPROVE_OPTION) {
p... |
449488b6-4dba-4be6-9e6e-76905b16279d | 3 | public boolean saveGame(Game game) {
if(game != null) {
try {
// If the directory does not exist yet, create it
if(!new File(savefolder).exists()) {
new File(savefolder).mkdirs();
}
FileOutputStream ... |
d540435f-e78f-459d-8bb1-4025150855e3 | 0 | public Field(int depth, int width)
{
this.depth = depth;
this.width = width;
field = new Object[depth][width];
} |
21dfda90-b11c-46b3-b766-a39729a91458 | 3 | public Payment setAddress(String name, String address, String city,String zip,String Phone)
{
try{
fullName.sendKeys(name);
addressLine1.sendKeys(address);
town.sendKeys(city);
postCode.sendKeys(zip);
phone.sendKeys(Phone);
//JavascriptExecutor executor = (JavascriptExecutor)Page.driver;
//executo... |
c5922553-b55e-4ae8-bb4d-21b3cb474b2d | 4 | private void sendProcessingError(Throwable t, ServletResponse response) {
String stackTrace = getStackTrace(t);
if (stackTrace != null && !stackTrace.equals("")) {
try {
response.setContentType("text/html");
PrintStream ps = new PrintStream(response.getOutput... |
5ff9bd4c-3dc0-451c-8add-0e1c0bd9bfda | 0 | public int getRoom() {
return room;
} |
854ed9f3-a843-4835-8be3-2015509e2f75 | 3 | protected static synchronized void download(String location, String filename) throws IOException {
URLConnection connection = new URL(location).openConnection();
connection.setUseCaches(false);
lastModified = connection.getLastModified();
String destination = "lib" + File.separator + filename;
File ... |
14c374c5-f355-40af-9694-be8031185f3f | 9 | private void FCBFElimination(double[][]rankedFeatures)
throws Exception {
int i,j;
m_rankedFCBF = new double[m_attributeList.length][4];
int[] attributes = new int[1];
int[] classAtrributes = new int[1];
int numSelectedAttributes = 0;
int startPoint = 0;
double tempSUIJ = 0;
Attri... |
7e1e2478-6aa4-4a90-a17f-d408e36347d9 | 2 | public Date deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) throws JsonParseException
{
if (!(json instanceof JsonPrimitive)) {
throw new JsonParseException("The date should be a string value");
}
Date date = deserializeToDate(json);
if (typeOfT == Date.class) {... |
89d24d11-5543-4b87-a65f-4b254fa96a61 | 7 | protected boolean matchAllParamTypes(Constructor<?> c, Class<?>[] paramTypes) {
boolean notMatch = false;
for (int i = 0; i < c.getParameterTypes().length; i++) {
Class<?> conParamType = c.getParameterTypes()[i];
Class<?> paramType = paramTypes[i];
if (paramType == null) {
// null parameter always matc... |
2f4e60f8-3c79-4649-b4bc-be85ca82837a | 7 | public Image getColumnImage(Object obj, int index) {
if (index == WorkflowColumn.STATUS.ordinal()) {
WorkflowJob jobInfo = (WorkflowJob) obj;
WorkflowJob.Status status = jobInfo.getStatus();
switch (status) {
case SUSPENDED:
return imgPause;
case FAILED:
return imgFailed;
case KILLED:
... |
5b588093-03f5-46b3-b85c-31ba67a17dd8 | 6 | @EventHandler(priority = EventPriority.HIGHEST)
public void onRightClicked(PlayerInteractEvent event){
Block block = event.getClickedBlock();
boolean isSign = false;
Sign sign = null;
Player player = event.getPlayer();
// CHECKS IF THE BLOCK CLICKED IS A SIGN, SO WE D... |
52878e4d-324d-46e4-b4ae-0962823307aa | 7 | static Node append(Node left, Node right){
if(left == null)
return right;
else if(right == null)
return left;
else if(left instanceof Red)
{
if(right instanceof Red)
{
Node app = append(left.right(), right.left());
if(app instanceof Red)
return red(app.key, app.val(),
red(left.key... |
f2b86856-1001-485e-9b1e-fa30afd6db07 | 8 | private void cargarPreferencias(){
String[] opciones = biblio.opcionesPorNombre("tipo-archivo");
for(int i=0; i<opciones.length; i++){
if(opciones[i].equals("img"))
chkImagen.setSelected(true);
if(opciones[i].equals("musica"))
chkMusica.setSelected(true);
if(opciones[i].equals("video"))
chkVide... |
cd297460-ea84-4d4f-b975-2c9be05c921e | 0 | public void removeFileChangeListener(FileChangeListener listener) {
fileListeners.remove(listener);
} |
32358a5d-34e1-4e9f-91bd-2aa58850c6aa | 2 | public int findNumberOfPixelsDiffering(int a,int b){
int result = a^b;
int _variations = 0;
while (result != 0)
{
if(result % 2 == 1){
_variations++;
}
result = result/2;
}
return _variations;
} |
0c2f5358-4c6a-4cc5-be18-7f16ba738294 | 2 | public void testPropertySetMilli() {
TimeOfDay test = new TimeOfDay(10, 20, 30, 40);
TimeOfDay copy = test.millisOfSecond().setCopy(12);
check(test, 10, 20, 30, 40);
check(copy, 10, 20, 30, 12);
try {
test.millisOfSecond().setCopy(1000);
fail();
... |
7145f200-3304-4c00-91f3-493801855d93 | 2 | public boolean check(int colum, int row)
{
char ch =(char)frame.getTable().getValueAt(row, colum);
if(ch != 'x' && ch != 'o')
{
return true;
}
return false;
} |
2dac19b0-22b0-4ad8-8c1f-656aae7514fc | 9 | public static void minSize(Deck d){
if(d.repeated){
int cards = 0;
int uniqueBasics = 0;
for(int i=0; i<d.cards.size(); i++){
cards += d.quantity.get(i);
String s = d.cards.get(i);
if(CardsInfo.has(s, "Basic")){
uniqueBasics++;
}
}
if(cards<60){
int add =60 - cards;
if(unique... |
5e37d3f2-04a1-49d9-8c7b-b023e064b390 | 3 | public void addBox(Box box)
{
boxes.add(box);
Rectangular sb = box.getVisualBounds();
if (contentBounds == null)
contentBounds = new Rectangular(sb);
else if (sb.getWidth() > 0 && sb.getHeight() > 0)
contentBounds.expandToEnclose(sb);
} |
42a327f4-a91c-4188-afb7-394b45414a32 | 1 | @RequestMapping(method = {RequestMethod.GET, RequestMethod.POST, RequestMethod.DELETE, RequestMethod.PUT}, produces = "application/json")
public ResponseEntity<?> doGetAjax() {
return new ResponseEntity<Object>(HttpStatus.FORBIDDEN);
} |
f02dbe32-6d48-458e-95cd-b6a01fc64c78 | 6 | public static void addcomment(String key, String text) {
try {
int id=getUserByKey(key);
if (sessionPerimee(key)||(id==-1)){//on crée une erreur pour sortir directement
throw new EndOfSessionException("Session terminee");
}
Mongo m = new Mongo("132.227.201.134",27017);
DB db = m.getDB("li328");
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.