method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
e61ce6c6-7c5c-4f7f-b024-6490f7e0ddc0 | 7 | public static void refreshCalendar(int month, int year) {
//Month variables.
String[] months = {"January", "February", "March", "April", "May", "June",
"July", "August", "September", "October", "November", "December"};
int numberOfDays, startOfMonth;
//Allow and dis... |
06fc946a-e24d-4a53-a37a-197608719089 | 4 | protected String validate(String phone) {
Pattern DOMESTIC_REGEX = Pattern.compile("^(?:\\([2-9]\\d{2}\\) ?|[2-9]\\d{2}(?:\\-?| ?|\\.?))[2-9]\\d{2}[- .]?\\d{4}$");
Pattern INTL_REGEX = Pattern.compile("^\\+(?:[0-9]??){6,14}[0-9]$");
if (phone == null) {
throw new NullPointerExceptio... |
c77f646d-f485-4d07-9ced-a9fc817c9893 | 4 | public boolean checkPowerUpCollision(PowerUp powerup) {
if (powerup.getCenterPosX() > this.getPaddleX() &&
powerup.getCenterPosX() < this.getPaddleX() + this.getPaddleWidth() &&
powerup.getCenterPosY() > this.getPaddleY() && powerup.getCenterPosY() < this.getPaddleY() + this.getPaddleHeight()) {
... |
e868ac1a-979a-45f1-9de2-dfa2d3c30e87 | 2 | public void testPropertySetMilli() {
LocalTime test = new LocalTime(10, 20, 30, 40);
LocalTime copy = test.millisOfSecond().setCopy(12);
check(test, 10, 20, 30, 40);
check(copy, 10, 20, 30, 12);
try {
test.millisOfSecond().setCopy(1000);
fail();
... |
1f601067-2ed7-44a8-bfbd-950ee4d5ca50 | 9 | public static void main(String[] args) {
// you get the white pieces, we play the black pieces
oe = new OurEvaluator();
ye = new YourEvaluator();
//ye = new OurEvaluator();
int depth = 5;
Position p = new Position();
p.setStartingPosition();
p.print();
... |
a6ea50aa-b148-4d13-9c1c-fe1ccd4d5f81 | 8 | public void initGame() {
JFrame frame = this;
// 12x12 pixel square on the screen. Pac-Man’s screen resolution is 336 x 432 (plus five rows for status totaling 60),
// so this gives us a total board size of 28 x 30 tiles,
frame.setMinimumSize(new Dimension(PacmanGame.WIDTH , Pacman... |
3bfdad34-b142-4925-8f85-da20e4dc2eae | 6 | public void replaceWithModel(Model model, boolean replaceAlpha) {
vertexCount = model.vertexCount;
triangleCount = model.triangleCount;
texturedTriangleCount = model.texturedTriangleCount;
if (anIntArray1622.length < vertexCount) {
anIntArray1622 = new int[vertexCount + 100];
anIntArray1623 = new int[vert... |
be0b79a6-a0e2-4349-8058-e8011165d109 | 3 | @Override
public Object parseObject(String source, ParsePosition pos) {
final Collection<? extends Object> results = parseObjects(source, pos);
return (results == null || results.isEmpty()) ? null : results.iterator().next();
} |
2ebbe359-273c-4458-be58-55866612340f | 8 | public static int getTurningPointIndex(int[] array) {
if (array.length == 0)
throw new IllegalArgumentException("Array length is zero!");
if (array.length == 1 || array.length == 2)
return 0;
int start = 0;
int end = array.length - 1;
int middle = (st... |
332041e7-7038-460d-adf7-f8d3b3e89f43 | 5 | private void seleccion (int generacion) {
int [] sel_super = new int[tam_pob];
float prob;
int pos_super;
int i;
//Ruleta
for (i=0; i<tam_pob; i++) {
prob=rnd.nextFloat();
pos_super=0;
while ((prob > Pob[pos_super].GetPuntuacionAcumulad... |
77e2a1ce-c08c-4d14-9ea1-396c4be04fe7 | 5 | public void updateAsScheduled(int numUpdates) {
//
// TODO: Impose cumulative stocking limits.
super.updateAsScheduled(numUpdates) ;
if (! structure.intact()) return ;
final float condition = (structure.repairLevel() + 1f) / 2 ;
final float stockBonus = 1 + (stockLevels[0] / 10f) ;
in... |
490a11bb-eabc-41cf-af80-bafd3fa54ff4 | 5 | public BrezenhemAlgorithm(){
_X = new ArrayList<Integer>();
_Y = new ArrayList<Integer>();
int x, y, dx, dy, incx, incy, pdx, pdy, es, el, err;
Coordinates.isCoordinates = false;
int x1 = Coordinates.x_1;
int x2 = Coordinates.x_2;
int y1 = Coordinates.y_1;
int y2 = Coordinates.y_2;
dx =... |
71180fde-b38b-48b5-8afa-964687624620 | 9 | private int validateInsert()
{
try
{
int receiptID;
int upc;
int quantity;
if (piReceiptID.getText().trim().length() != 0 && isNumeric(piReceiptID.getText().trim()))
{
receiptID = Integer.valueOf(piReceiptID.getText().trim()).intValue();
} else {
return VALIDATIONERROR;
}
... |
d5fe84e1-6b0f-4c99-ac66-d9b4529230a8 | 8 | private static
boolean targetIsXml(char[] buf, int off, int end) throws InvalidTokenException {
boolean upper = false;
if (end - off != 3)
return false;
switch (buf[off]) {
case 'x':
break;
case 'X':
upper = true;
break;
default:
return false;
}
off += 1;
... |
5fcd270e-d815-4a7b-853c-cc5203895cfb | 2 | public void render(){
// BLUE BACKGROUND
GL11.glDisable(GL11.GL_TEXTURE_2D);
GL11.glColor3f(0.5f, 0.7f, 1f);
GL11.glBegin(GL11.GL_QUADS);
GL11.glVertex2f(0 , 0);
GL11.glVertex2f(Game.SCREEN_WIDTH, 0);
GL11.glVertex2f(Game.SCREEN_WIDTH, Game.SCREEN_HEIGHT);
GL11.glVertex2f(0, Game.SCREEN_HEIGHT);
GL... |
e0bb17a7-f8f3-48ab-9283-49162b748688 | 7 | public static Perfume[] getAllPerfume()
{
Perfume[] pf = null;
String csvFile = PerfumeFactory.class.getResource("/Resource/perfume_data.csv").getPath();
BufferedReader br = null;
String cvsSplitBy = ";";
try {
br = new BufferedReader(new FileReader(csvFile));
StringBuffer fileb = new StringBuffe... |
aa75abee-0335-4693-ab9d-8579ab724257 | 7 | private String[] getMergedCells() throws Exception
{
String[] array = null;
Row r = null;
for ( int i=0;i<rows.size();i++ )
{
r = rows.get(i);
if ( r.versions.nextSetBit(base)==base )
break;
else
r = null;
}
... |
58cf39ac-e83c-447a-a62e-47e4de97d540 | 9 | public PagarMeQueryResponse execute(){
try {
UriBuilder builder = UriBuilder.fromPath(API_ENDPOINT);
builder.path(path);
StringBuilder query = new StringBuilder();
query.append(MapUtil.listOfMapToString(queries));
if(!method.toUpperCase().equals("POST") && !method.toUpperCase().equals("PUT")){
b... |
394a0235-f606-45ad-b404-279d29398852 | 2 | public final void changeTimeout(int timeOut)
throws ArtistBiographyException {
if(timeOut < 1000 || timeOut > 20000)
throw new ArtistBiographyException("The timeout vale is not correct");
ArtistBiography.timeOut= timeOut;
} |
7df0da84-a897-4ec6-b366-a64d5d087df6 | 1 | private void setPlaymodeSelection(boolean b){
for (int i = 0; i < alstPlaymodePanels.size(); i++) {
alstPlaymodePanels.get(i).setEnabled(b);;
}
} |
e97f9236-493c-46aa-96bc-11e3fd05f598 | 3 | private void appendGradientDefs(Document document, Element defs, Set<String> colors) {
// default
if(!colors.contains(defaultColor)) {
defs.appendChild(createGradientForNode(document, defaultColor));
}
for(String color : colors) {
if(!color.equals("none"))
... |
e78364e3-6c3d-4c6e-8c07-fb90d3a022ac | 9 | @Override
public void putAll( Map< ? extends K, ? extends V > map )
{
// Obtain iterator to parameter map's entry set
Iterator< ? extends Map.Entry< ? extends K, ? extends V > > it = null;
try
{
it = map.entrySet().iterator();
}
catch... |
01ce7d86-ee92-42fe-92f4-fd413a6a7e07 | 6 | public static double hypot(final double x, final double y) {
if (Double.isInfinite(x) || Double.isInfinite(y)) {
return Double.POSITIVE_INFINITY;
} else if (Double.isNaN(x) || Double.isNaN(y)) {
return Double.NaN;
} else {
final int expX = getExponent(x);
final int expY = getExponent(y);
if (expX ... |
c5ccd15c-c3bf-4752-b53e-056260b9d5d0 | 6 | private void ifStatement() {
boolean hasElse = false;
lex(); expect(TK_OPENPAREN);
// condition
expression();
expect(TK_CLOSEPAREN);
int ifStart = _func.addInst(JMPF, 0); // 0 is the amount to jump so far
beginScope();
statement();
if (_pretoken != TK_CLOSEBRACE && _pretoken != TK_SEMICOLO... |
28c9c55a-dd4e-4ace-b951-1234384ac922 | 4 | private Path parseTargetFolder(String[] args) {
Path result;
if (args == null || args.length < 2) {
throw new IllegalArgumentException("Не указаны параметры приложения: habrsaver d:/habr_articles 156395 183494");
} else {
result = Paths.get(args[0]);
if (!resu... |
b75d48b7-f0b4-4f12-87ba-32f7d158259a | 8 | public double fx_i() {
double d = 0.0;
if (hasCharge_i && hasCharge_j)
d += chargeChargeVsX_i();
if (hasDipole_i && hasDipole_j)
d += dipoleDipoleVsX_i();
if (hasCharge_i && hasDipole_j)
d += pjqiVsX_i();
if (hasDipole_i && hasCharge_j)
d += piqjVsX_i();
return d * rCD;
} |
640f7b5c-951a-45db-8e50-df3f737a6841 | 4 | public boolean collision(Polyomino p) {
if(getDelay() > 0) return false;
Iterator<Brick> itr = p.getBricks().iterator();
while(itr.hasNext()) {
Brick b = (Brick) itr.next();
if(b.getAbsoluteCoords().x == position.x && b.getAbsoluteCoords().y == position.y) {
return true;
}
}
return false;
} |
88e422ff-6cd5-40a7-b4a2-3a08e3675526 | 8 | protected void processEvent(Sim_event ev){
switch ( ev.get_tag() )
{
case AuctionTags.AUCTION_TIMEOUT:
synchronized(syncStep){
if(!isClosed())
closeAuction();
}
break;
case AuctionTags.AUCTION_PROPOSE:
MessageBi... |
68e42f74-f189-429f-b07c-30e8622d41be | 3 | public int getRandomQuestion(){
Random r = new Random();
int x = 0;
do{
int i = r.nextInt(checklist.size());
if(checklist.containsKey(i)){
return i;
}
x++;
}while(x <=5);
for(int i:checklist.keySet()){
return i;
}
return 0;
} |
5751bb37-946a-41c1-81e2-074dcb268a40 | 3 | public Collection<IrodsCollection> listCollections() throws IrodsException {
List<IrodsCollection> l = new ArrayList<IrodsCollection>();
for (File f : irodsFile.listFiles()) {
if (f instanceof IRODSFile && f.isDirectory()) {
l.add(new JargonCollection(conn, (IRODSFile) f));
}
}
return l;
} |
bbe58bf9-0430-4200-9fe7-e5164f0f0b0c | 3 | @Override
public void put(Key key, Value val)
{
if (val == null)
{
delete(key);
return;
}
for (Node x = first; x != null; x = x.next)
{
// cmp++;
if (key.equals(x.key)) // Search hit: update val
{
x.val = val;
return;
}
}
first = new Node(key, val, first); // Search miss: add ... |
b94b8de4-37a1-4683-aa04-fac778e026f7 | 0 | public Rectangle getRect()
{
return rect;
} |
58a6f11d-8908-4b27-a4bc-8b39919e2e9e | 2 | public void areStreamsUp() {
if (!streamList.isEmpty()) {
for (;threadCount < streamList.size(); threadCount++) {
new StreamIsUp(streamList.get(threadCount), threadCount, streamName.get(threadCount)).start();
}
}
} |
7643db99-6cee-43d7-b102-968c104a8684 | 9 | @SuppressWarnings("unchecked")
TheCalendar(JFrame parent){
// Sets OS specific look to the calendar
try {
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
}
catch (ClassNotFoundException e) {
}
catch (InstantiationException e) {
}
catch (IllegalAccessException e) {
}
catch... |
d7cf1007-24ed-4bf8-9fe3-7ed1b4fb3634 | 6 | public static boolean arithmeticEqualTest(NumberWrapper x, NumberWrapper y) {
{ Surrogate testValue000 = Stella_Object.safePrimaryType(x);
if (Surrogate.subtypeOfIntegerP(testValue000)) {
{ IntegerWrapper x000 = ((IntegerWrapper)(x));
{ Surrogate testValue001 = Stella_Object.safePrimaryTyp... |
50814a25-63b7-455e-8549-2ccb116db859 | 2 | public void update(){
if(countUp){
counter++;
}
if(counter > 5){
color = baseColor;
countUp = false;
counter = 0;
}
} |
97bf3006-ff2a-4aea-8458-e95b4dbdeaf1 | 1 | public Double getValorFinal() {
if (valorFinal==null) {
return 0.00;
}
return valorFinal;
} |
9508b19f-cef1-4465-9fbc-e7cf4e9da9b4 | 8 | private void acceptSplit(DockDropEvent event, DockingConstants.Split position) {
Container container = event.getDragSource().getDockableContainer();
Dockable dockable = event.getDragSource().getDockable();//2005/12/08
TabbedDockableContainer tabAncestor = DockingUtilities.findTabbedDockableContainer(dockable);
... |
a454529a-21a1-43ff-a302-1dcdca965c81 | 3 | public BufferedImage[] loadStripImageArray(String fnm, int number) {
if (number <= 0) {
EIError.debugMsg("number <= 0; returning null", EIError.ErrorLevel.Error);
return null;
}
BufferedImage stripIm;
if ((stripIm = loadImage(fnm)) == null) {
EIError.... |
49881b5f-7766-4cde-9873-585acccc2422 | 5 | public synchronized void lock(Object user, MemoryManageable mm) {
if (user == null || mm == null)
return;
//System.out.println("+-+ MM.lock() user: " + user + ", mm: " + mm);
HashSet<MemoryManageable> inUse = locked.get(user);
if (inUse == null) {
inUse = new HashSet<M... |
c1070279-4c27-495f-ae21-d933262a29ef | 0 | public Worker () {
//initial settings
isInputActive = true;
isEventSet1 = false;
isEventSet2 = false;
this.keyboard = new BufferedReader(new InputStreamReader(System.in));
System.out.println(MSG_WELCOME);
//start
this.lifeCycle();
} |
fc163530-0bb2-4776-9279-83812a6aa497 | 9 | public static BigInteger GCD(BigInteger x, BigInteger y) {
if (x.equals(BigInteger.ZERO)) {
return y;
}
if (y.equals(BigInteger.ZERO)) {
return x;
}
if (isEven(x) && isEven(y)) {
x = x.shiftRight(1);
y = y.shiftRight(1);
return TWO.multiply(GCD(x, y));
}
if (isOdd(x) && isEven(y)) {
... |
ceea545e-e9b5-425d-995a-42154386f3aa | 4 | public boolean isVisible(Coordinate c) {
if (c.x > getSize().width || c.y > getSize().height || c.x < 0 || c.y < 0)
return false;
return true;
} |
3c922f32-4f19-44a4-8f44-23992ff4ce07 | 3 | public boolean isEqual(int dim, int x, int y, int z) {
return this.x == x && this.y == y && this.z == z && this.dimension == dim;
} |
5a8fd048-1268-4b0f-bee9-350e93401ddb | 6 | public boolean testAvailabe(int H, int V, int A) { // H&V number want be bls of
// indH &indV A = index
if ((this.indexH + H) >= 8 || (this.indexV + V) >= 8
|| (this.indexV + V) < 0 || (this.indexH + H) < 0) {
this.availableCells[A] = null;
} // ok
else if (myBoard.bordaCell[this.indexH + H][this... |
625c7ab2-746e-437d-bf97-60b6e3d5373f | 9 | public void render() {
BufferStrategy bs = getBufferStrategy();
if (bs == null) {
createBufferStrategy(2);
return;
}
Graphics g = bs.getDrawGraphics();
g.setColor(Color.lightGray);
g.fillRect(0, 0, getWidth(), getHeight());
//drawing ... |
5e6eb729-6583-4ec7-abdc-6f35225cd9aa | 1 | protected final Label getLabel(final Object label) {
Label lbl = (Label) labels.get(label);
if (lbl == null) {
lbl = new Label();
labels.put(label, lbl);
}
return lbl;
} |
2d004438-595a-438a-b157-e46fc6d64c63 | 5 | private static boolean equalLists(int[] l1, int[] l2) {
if (l1 != null && l2 != null && l1.length == l2.length) {
for (int i = 0; i < l1.length; i++) {
if (l1[i] != l2[i]) {
return false;
}
}
return true;
} else {
return false;
}
} |
6d5df042-c806-42d6-a1f9-0a47910ade96 | 8 | public void setProperty(String name,
Object value) throws IllegalArgumentException, IllegalStateException
{
if(name == null) {
throw new IllegalArgumentException("property name can not be null");
}
if(PROPERTY_SERIALIZER_INDENTATION.equals(name)) {
... |
de460c56-13f1-43a7-9f5f-c3a0f67bceed | 9 | public static void update(Player updated) {
System.out.println("update friends");
int worldId = -1;
for(World world : Worlds.getWorlds()) {
if (world.getPlayers().contains(updated)) {
worldId = world.getId();
break;
}
}
System.out.println("Second : "+updated.getPrivateChat());
for (World world... |
8b9ab97a-c825-495e-9cdb-97aa8b443a38 | 4 | private static void printLines(String name, InputStream ins) throws Exception {
String line = null;
BufferedReader in = new BufferedReader(
new InputStreamReader(ins));
int l = 1;
while ((line = in.readLine()) != null) {
if (l == 6) {
CommandHandler.sendAccordingToMSG("Max lines reached");
break;... |
81451be6-5a5a-4e14-afc5-62682957d705 | 5 | @Override
public void run() {
LogUtils.log(Level.INFO, LauncherConstants.USER_UUID_PREFIX + "Getting UUID from " + LauncherConstants.UUID_URL + "...");
UserUUID.UUID result = null;
try {
final Gson gson = new Gson();
final UUIDResponse response = gson.fromJson(ConnectionUtils.httpJsonPost(LauncherConstants... |
7424c84c-2aba-43ee-bf94-20ddacc349fa | 0 | public String getAuteur() {
return auteur;
} |
4ae286f3-3991-409d-8a28-926f30c58aac | 0 | public UpdateHandler(LogOre plugin, Choice choice, int id, String file) {
this.plugin = plugin;
this.choice = choice;
this.id = id;
this.file = file;
this.plugin.getServer().getScheduler().runTaskLater(this.plugin,
new UpdateRunnable(this.plugin, choice, this.id, ... |
1c7cdcdb-f10b-4bc2-acbc-d789b07cb915 | 2 | public String getClassName() {
String cname;
ConstPool cp = getConstPool();
int pos = currentPos;
int c = iterator.byteAt(pos);
int index = iterator.u16bitAt(pos + 1);
if (c == INVOKEINTERFACE)
cname = cp.getInterfaceMethodrefClassName(index);
else
... |
05b17cd3-8291-432b-8931-a39ae5af7b8e | 8 | @Override
public void keyTyped(KeyEvent e) {
switch (e.getKeyChar()) {
case 't':
case 'T':
getScreen().addEmptyTeam();
break;
case 'w':
case 'W':
getScreen().addWorm();
break;
case 'f':
case 'F':
getScreen().addFood();
break;
case 's':
case 'S':
getScreen().startGame();
break;... |
dbcf6fd5-b044-48fb-ac53-558e476ef536 | 8 | @Override
public boolean invoke(MOB mob, List<String> commands, Physical givenTarget, boolean auto, int asLevel)
{
final Set<MOB> h=properTargets(mob,givenTarget,false);
if(h==null)
{
mob.tell(L("There doesn't appear to be anyone here worth making fly."));
return false;
}
if(!super.invoke(mob,command... |
51c93e3d-6fb0-47fd-adfe-794543adac6d | 9 | public int recalcMembersip() {
final int maxCentroidSize = new Double(this.docs.size() / 1.2).intValue();
final Set<Integer> bestCentroids = new HashSet<Integer>();
int bestCentroid;
final List<List<Integer>> newMembership = new ArrayList<List<Integer>>();
boolean toContinue = true;
int change = 0;
while (toCont... |
0a24e271-dad6-4819-9627-13c87c79798e | 4 | public boolean isInWindow(int mouseX, int mouseY){
mouseY = Standards.W_HEIGHT - mouseY - 1;
if ((mouseX > ScreenX) && (mouseX < ScreenX + Width)){
if ((mouseY > ScreenY) && (mouseY < ScreenY + getTotalHeight())){
return true;
}
}
return false;
} |
1e5386fe-90d0-412c-b81e-a87fecdcce30 | 1 | private void addPutfield0(CtClass target, String classname,
String name, String desc) {
add(PUTFIELD);
// target is null if it represents THIS.
int ci = classname == null ? constPool.addClassInfo(target)
: constPool.addClassInfo(cl... |
03bd736d-7704-4334-97c9-289f889c26dd | 4 | private static Expression getGreater(Expression left, Expression right) {
if (left instanceof Greater || left instanceof GreaterOrEqual) {
return left;
}
if (right instanceof Greater || right instanceof GreaterOrEqual) {
return right;
}
return null;
} |
6d44aa04-65d6-4471-b33a-4316a933997b | 4 | public String getLocationUpdateStatusString() {
switch (locationUpdateStatus) {
case "00":
return "Updated";
case "01":
return "Not updated";
case "02":
return "Forbidden PLMN";
case "03":
return "For... |
29dfc61f-c92b-4696-8ce9-b1157cfec287 | 4 | private boolean writeToFile(FileWriter fstream) {
BufferedWriter out = new BufferedWriter(fstream);
try {
out.write(constructXml());
} catch (IOException e1) {
ErrorMessage.show(
"Eroare cand a fost scris fisierul de modificari", false);
e1.printStackTrace();
return false;
} catch (Transformer... |
d175280c-0b06-464e-aadc-18763cfca790 | 1 | private void addParticle() throws NumberFormatException, IOException {
double[] coordList = new double[dimensionList.length];
double mass = 0D;
for (int count = 0; count < dimensionList.length; count++) {
System.out.println("Enter " + dimensionList[count].toString() + "-coord:");
coordList[count] = Double.p... |
67e71fc8-3bbb-4481-a97a-fe7dc86c65a2 | 9 | @Test
public void testMakingSuggestions_Randomness() {
//Setup:
ComputerPlayer detective = new ComputerPlayer();
detective.setUnseenCards(clue.getDeck());
//Test randomness of suggestions: Multiple weapons and people are unseen
//(specifically, the suspect can be either Space Cadet Grey or Cosmonaut... |
cb824f97-a36f-4494-a95c-e493fce0676e | 7 | private String getComverMover(int fil, int col, int turno){
if(Math.abs(fil-this.fila)==Math.abs(col-this.columna)){
return getDama(turno);
}else if(this.fila==fil){
if(this.columna>col||this.columna<col)
return getDama(turno);
}else if(this.columna==col){... |
d61a9425-86cc-41a7-859a-2d5e0b5ce6e7 | 2 | public String removeDescendantNode(String locationpath){
boolean flag = true;
while (flag){
if (locationpath.contains("descendant-or-self::node()/child::")){
locationpath = locationpath.replace("descendant-or-self::node()/child::", "descendant-or-self::");
}else{
flag = false;
}
}
return... |
c31a8412-4b60-4e6b-9b2b-86624ecc144e | 2 | public Song(File featureFile)
throws ClusterException {
this.path= featureFile.getAbsolutePath();
try {
this.position= LoadRhythmHistogram.getValues(featureFile);
} catch (JAXBException e) {
throw new ClusterException(e.getMessage(), e);
} catch (SAXException e) {
throw new ClusterException(e.ge... |
fa1fe551-b5dd-4ad5-ad18-2b8a3ee56217 | 3 | public int write(ResultSet rs) throws IOException, SQLException {
ResultSetMetaData md = rs.getMetaData();
int colCount = md.getColumnCount();
println("<table border=1>");
print("<tr>");
for (int i=1; i<=colCount; i++) {
print("<th>");
print(md.getColumnLabel(i));
}
println("</tr>");
int rowCount... |
9d01d86c-93a6-412e-88fa-7b2ca8f69bb7 | 6 | public int compareTo(SimEvent event)
{
if (occurringTime < event.occurringTime) return -1;
if (occurringTime > event.occurringTime) return 1;
if (priority > event.priority) return -1;
if (priority < event.priority) return 1;
if (hashCode > event.hashCode) return -1;
if (hashCode < event.hashCode) return 1;... |
c76367a9-ff5a-447b-b642-1406ef7261af | 1 | public String getName() {
return this.isWhite ? "White" : "Black";
} |
47f2c372-6137-4bb2-9b4c-702f341728ba | 6 | public boolean compareRelation(String first, String second, char relation,
String type) {
if (relation == '>') {
if (type.equalsIgnoreCase("String")) {
return first.compareTo(second) > 0;
}
return Double.parseDouble(first) > Double.parseDouble(second);
}
if (relation == '<') {
if (type.equalsIg... |
9727ca9c-7216-400f-905c-0ed4a363e51e | 6 | private void censored(int row) {
if (!MyFactory.getResourceService().hasRight(MyFactory.getCurrentUser(), Resource.CENSORED)) {
return;
}
Consumption selectedRow = result == null ? null : result.get(row);
if (selectedRow != null) {
int result = JOptionPane.showCon... |
5089fa7b-47c4-4a23-8954-06263558f12f | 8 | public Workflow fromXML(File xmlFile) throws ParserConfigurationException, SAXException, IOException, TransformerException, ClassNotFoundException, InstantiationException, IllegalAccessException, SecurityException, NoSuchMethodException, IllegalArgumentException, InvocationTargetException {
init();
Document do... |
7d622acf-90c8-4aba-84b6-f19ae8b96cd9 | 4 | public MethodVisitor visitMethod(
final int access,
final String name,
final String desc,
final String signature,
final String[] exceptions)
{
StringBuffer sb = new StringBuffer();
appendAccess(access, sb);
AttributesImpl att = new AttributesImpl();
... |
5192a1ef-6694-4721-ac00-b3147b648056 | 3 | @Override
public String execute() throws Exception {
try {
Map session = ActionContext.getContext().getSession();
Campaign camp = (Campaign) session.get("campa");
CampaignDevice campdev = new CampaignDevice(camp, getPlatform());
getMyDao().getDbsession().sa... |
126d96de-21b5-47c2-a6dd-6bdcd472b6e1 | 8 | private void newContact() {
final JDialog dialog = new JDialog();
dialog.setResizable(false);
dialog.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
dialog.setTitle("Neuen Kontakt erstellen");
dialog.setBounds(this.getLocationOnScreen().x + 350,
this.getLocationOnScreen().y + 80, 230, 180);
dialog.g... |
8415d574-46fb-4248-8b19-6906d5a91722 | 1 | public void mousemove(Coord c) {
if (rsm){
Coord d = c.sub(doff);
mm.sz = mm.sz.add(d);
mm.sz.x = Math.max(minsz.x, mm.sz.x);
mm.sz.y = Math.max(minsz.y, mm.sz.y);
doff = c;
pack();
} else {
super.mousemove(c);
}
} |
39b1926a-2d13-4743-9140-a282fd0c1ce6 | 8 | private static Vec3D func_48621_c(EntityCreature par0EntityCreature, int par1, int par2, Vec3D par3Vec3D)
{
Random var4 = par0EntityCreature.getRNG();
boolean var5 = false;
int var6 = 0;
int var7 = 0;
int var8 = 0;
float var9 = -99999.0F;
boolean var10;
... |
67e09bc8-4fa6-4c17-859a-507e585dd1c8 | 7 | private int YUV_to_BGR(int Y,int u,int v){
if(Y<0) Y=0;
int tempB,tempG,tempR;
tempB=Y+((116130*u)>>16);
if(tempB<0) tempB=0;
else if(tempB>255) tempB=255;
tempG=Y-((22554*u+46802*v)>>16);
if(tempG<0) tempG=0;
else if(tempG>255) tempG=255;
tempR=Y+((91881*v)>>16);
if(tempR... |
155722a6-1aa0-4164-a892-1d13569e47a0 | 7 | public static final void UseMountFood(final SeekableLittleEndianAccessor slea, final MapleClient c, final MapleCharacter chr) {
slea.skip(4);
final byte slot = (byte) slea.readShort();
final int itemid = slea.readInt(); //2260000 usually
final IItem toUse = chr.getInventory(MapleInventor... |
30bb8044-f53a-450e-beb0-1e76af0d661e | 2 | public void createForSelected() {
Production[] p = grammarView.getSelected();
for (int i = 0; i < p.length; i++) {
if (alreadyDone.contains(p[i]))
continue;
Transition t = (Transition) pToT.get(p[i]);
automaton.addTransition(t);
}
} |
e84e2e98-a663-4af1-88be-afdac00e3afc | 6 | public void niveauPert() {
int max = 0;
ListeSommets liste = new ListeSommets();
Fenetre.lePert.source.niveau = 0;
liste.add(Fenetre.lePert.source);
for (int i = 0; i < liste.size(); i++) {
liste.addAll(liste.elementAt(i).getSuccesseurs());
Iterator<Sommet> it = liste.elementAt(i).getSuccesseurs()
... |
ab316525-5fd2-4930-9f63-5326923ddcb9 | 3 | private static Packet getGameCreatedPacket(String packet) {
Scanner sc = new Scanner(packet);
if(!sc.next().equals(Packet.PACKET_CODES.GAME_CREATED_CODE)) return null;
Packet res = new Packet(Packet.PACKET_CODES.GAME_CREATED_CODE);
Integer ID;
... |
4856ffa7-2082-4108-9e54-ec095357da03 | 3 | public static void main(String[] args)
{
Digraph G = null;
try
{
G = new Digraph(new In(args[0]));
System.out.println(args[0] + "\n" + G);
}
catch (Exception e)
{
System.out.println(e);
System.exit(1);
}
DirectedCycle cycleFinder = new DirectedCycle(G);
if (cycleFinder.hasCycle())
{
... |
736347f0-223d-4dde-8f55-501df6ecabfa | 2 | public void close()
{
if(folder.exists())
{
File [] fileList = folder.listFiles();
for(int i=0;i<fileList.length;i++)
{
fileList[i].delete();
}
folder.delete();
}
} |
6e09092a-9bef-468c-a21d-1ab150782e0c | 1 | public String[] getProperties(String key) throws PropertyNotFoundException {
String[] value = null;
if (null != properties.getProperty(key)) {
value = properties.getProperty(key).trim().split(Constants.PROPERTIES_SEPARATOR.toString());
} else {
String errorMsg = new StringBuilder(key).append(" property not ... |
d55cd2fd-bdde-4fcb-b418-50c0b3062e2a | 7 | public static boolean orderedEquals(final Iterable<?> it1, final Iterable<?> it2) {
final Iterator<?> i1 = it1.iterator();
final Iterator<?> i2 = it2.iterator();
while (i1.hasNext()) {
final Object o1 = i1.next();
if (!i2.hasNext() || !Objects.equals(o1, i2.next())) {
... |
7ba768a0-2612-43ea-9217-5849a21a4ee4 | 7 | public static Map<String, String> parseCommandLineArguments(String[] args) {
Map<String, String> arg_map = new TreeMap<String, String>();
String key = null, value = null;
if (BuildConfig.DEBUG)
System.out.println("parseCommandLineArguments : Parse "
+ Collections.stringOfArray(args, " | ", "[ ", " ]"));
... |
a18c7e05-f18e-4c7a-9153-43c73982d103 | 4 | public void connect(String server, String port, boolean ssl_enabled)
{
try
{
if(ssl_enabled)
{
System.setProperty("https.protocols", "SSLv3");
SSLSocketFactory f = (SSLSocketFactory)SSLSocketFactory.getDefault();
ssl_socket = (SSLSocket)f.createSocket(server, Integer.parseI... |
ea59c314-6153-4a8f-b0a8-91e889076a8e | 9 | public void update(GameContainer gc, StateBasedGame sbg, int delta) throws SlickException {
Input input = gc.getInput();
Transition t = new FadeOutTransition();
if(input.isKeyDown(Input.KEY_ESCAPE))
sbg.enterState(PongGame.GAMEPLAYSTATE, t, t);
if(pvpButtonArea.isMouseOver()){
if(input.isMouseButtonDow... |
c87040cf-0c0e-4ec5-bd8c-42b7801f6108 | 2 | private void moveLinesDown(int n) {
while (n >= 0) {
if (n > 0) {
rows[n] = rows[n-1];
}
else {
rows[n] = new Block[LINE_WIDTH];
}
n--;
}
} |
e1bfa83d-ecba-4543-9c99-33d6293bf4fa | 6 | private static void testSwap() {
int tests = 0;
int failed = 0;
printHeader("Testing Swap");
try {
ColumnPuzzle temp = new ColumnPuzzle(3);
temp.setup(3);
temp.window.setVisible(false);
temp.window.dispose();
for (int row = 0... |
3b81137b-cdbc-452a-b11c-699f6530e566 | 5 | private static void getData(Matrix matrix, String line) {
String[] cols = line.toLowerCase().split(",");
if (matrix.getNumCols() != cols.length) {
throw new MLException(String.format(
"Number of columns mismatch. Expected: %d, Got: %d", matrix.getNumCols(), cols.length));... |
3e3c8d37-94aa-484b-ac25-6dc2c789648f | 7 | private String getBackColorOfEntity(IEntity entity) {
if (entity.getSpecificBackColor() != null) {
return "\"" + getAsHtml(entity.getSpecificBackColor()) + "\"";
}
final String stereo = entity.getStereotype() == null ? null : entity.getStereotype().getLabel();
if (entity.getType() == EntityType.STATE || enti... |
5874afda-3da2-4346-a104-f3e3a14450ef | 7 | public static String readLine( InputStream in )
throws EOFException,
IOException {
/* input must not be null */
if( in == null )
throw new NullPointerException( "Cannot read from null." );
int CR = 0xD; // 13 decimal
int LF = 0xA; // 10 decimal
/* Try to read the next text line from the input ... |
0d67e54f-e16f-4901-8529-e68cc23f5e2e | 0 | public String getEmailId() {
return emailId;
} |
0d2e4e01-ed62-4e9a-ab0b-76421bdd487e | 9 | public synchronized void setAttribute(String name, Object value)
{
if (_invalid) throw new IllegalStateException();
if (_values==null)
_values=newAttributeMap();
Object oldValue = _values.put(name,value);
if (value==null || !value.equa... |
3f679069-43f0-4771-a93a-608aabdb3363 | 5 | private static void processSink(final Socket connectionSocket) {
//increment the sink count
sinkCount.addAndGet(1);
//create a new sink task
Runnable sinkTask = new Runnable() {
@Override
public void run() {
//get sink socket
Socket... |
4932728d-6578-4e72-a187-7333c98117ff | 4 | public IndividualGeneIdentifier_Type(JCas jcas, Type casType) {
super(jcas, casType);
casImpl.getFSClassRegistry().addGeneratorForType((TypeImpl)this.casType, getFSGenerator());
casFeat_SentenceID = jcas.getRequiredFeatureDE(casType, "SentenceID", "uima.cas.String", featOkTst);
casFeatCode_SentenceID... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.