method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
54a4942a-b9dc-40cf-9cb1-d20c724675b3 | 8 | public static int[] searchRangeImproved(int[] A, int target) {
int s = 0;
int e = A.length;
while(s < e){
int mid = (s + e) / 2;
if(A[mid] == target) {
int ss = mid;
int ee = mid;
while(ss - 1 >= 0 && A[ss-1] == target)
ss--;
while(ee + 1 < A.length && A... |
bccc2029-7400-404a-aefa-07b8079f35bb | 2 | public static boolean hasProperty(Class clazz, String name) {
String key = clazz.getName() + "#" + name;
if (searchCache.containsKey(key)) {
return searchCache.get(key).booleanValue();
} else {
boolean found = true;
try {
getProperty(clazz, nam... |
c5c1b0d4-5266-42bd-bf47-650b6cc22aac | 6 | private void calculate(){
switch(inmode){
case 0: break;
case 1: if(neighborstate[0] == 1){active = true; state = 1;}else{active = false; state = 0;}break;
case 2: state = neighborstate[0]; if(state < 1){active = false;} else{active = true;}break;
default:state = neighborstate[0]; if(state < 1){activ... |
9618899e-2c40-49b5-99c9-5afa77380395 | 9 | @Override
public int compareTo(Object obj) {
if (!(obj instanceof NameRecord)) {
return -1;
}
NameRecord rec = (NameRecord) obj;
if (this.platformID > rec.platformID) {
return 1;
} else if (this.platf... |
5fff008e-9d56-4cd8-aa2f-f28aa5deec3c | 9 | protected boolean horizontalLevelCollision() {
// to know if the player can move, we test every pixel for the next position (except the one where the player is, of course)
int direction = (int) (this.speedX/Math.abs(this.speedX)); // -1 for left, 1 for right)
double startPos = this.posX;
if (direction == 1)
... |
490209f9-4c15-4db5-800f-c47cf49e4321 | 2 | public void testMultipliedBy() {
Period base = new Period(1, 2, 3, 4, 5, 6, 7, 8);
Period test = base.multipliedBy(1);
assertSame(base, test);
test = base.multipliedBy(0);
assertEquals(Period.ZERO, test);
test = base.multipliedBy(2);
ass... |
4f31817a-bf8d-4ce1-a726-a1627047433e | 9 | @Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
Grid other = (Grid) obj;
if (gridHeight != other.gridHeight)
return false;
if (gridWidth != other.gridWidth)
return false;
// check arr... |
3f8b6352-46da-4956-97fc-aed2f9912457 | 8 | private int getRgb(int rank)
{
rank = rank < 0 ? 0 : rank;
Integer rgb;
int red = 0;
int green = 0;
int blue = 0;
String rgbString;
String redString;
String greenString;
String blueString;
if (rank <= 25)
{
red = 2... |
811eec30-fa2e-478c-8c1e-84745365f69b | 3 | public Object getValueAt(int row, int col) {
if (row > -1 && col > -1 && data != null) {
return data[row][col];
} else {
return null;
}
} |
c827d23f-07d9-477d-b644-7108bf4ee0a7 | 0 | public double getHeight() {
return _height;
} |
55b1f56d-7bdc-4f56-aef7-29f43b984ad2 | 4 | public void paintComponent(Graphics g) {
super.paintComponent(g);
if (workingImage != null) {
BufferedImage bufferedImage = toCompatibleImage(workingImage
.getBufferedImage());
g.drawImage(bufferedImage, 0, 0, null);
}
if (drawingContainer != null) {
for (Point p : drawingContainer.in) {
g.se... |
5736026f-fcfb-45f3-bf36-190bcd906f84 | 6 | public void run() {
while (ircConnection.isRunning()) {
if (!(eventQueue == null) && !eventQueue.isEmpty()) {
transferEntry();
}
try {
Thread.sleep(messageDelay);
} catch (Exception e) {
// ignore
}
}
while (!eventQueue.isEmpty() && !ircConnection.isChannelEmpty()) {
transferEntry(... |
8bfe8e5c-0e0e-476b-844f-631e4bdea725 | 1 | @Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result
+ ((carriageNumber == null) ? 0 : carriageNumber.hashCode());
result = prime * result + ID;
return result;
} |
e96c9f09-164d-40bf-abe4-f0d663cf87b4 | 0 | public void setEmail(String email) {
this.email = email;
} |
aed78762-3588-4b32-9a1e-760102f6455b | 5 | @Override
public void alterarQuantidadeItemListaDeDesejos(
UsuarioProduto usuarioProduto) {
EntityManagerFactory factory = Persistence
.createEntityManagerFactory("classeEncanto");
EntityManager em = beginTransaction(factory);
try {
Set<UsuarioProduto> listaDeDesejos = usuarioProduto.getUsuario()
... |
b73b3d2b-ab82-4018-8164-418f668ca660 | 0 | public void setIsFinished(Boolean isFinished) {
this.isFinished = isFinished;
} |
5a17d778-da06-498f-b3c5-becea27f04e5 | 1 | @Override
public int hashCode() {
return name != null ? name.hashCode() : 0;
} |
a1d36a31-9e4b-46ab-bc83-aa131c2ed2f6 | 0 | @Override
public final String toString() {
final StringBuilder sb = new StringBuilder();
sb.append(this.k).append('=').append('(').append(this.v).append(',').append(this.h).append(')');
return sb.toString();
} |
0e5934d7-c2d1-4ba3-915f-2d817ebbd98d | 2 | private int get_Where_the_true_code(myDataList mylist) {
for (int i = 0; i < mylist.size(); i++) {
if (((data) mylist.get(i)).isFlag())
return i;
}
return -1;
} |
7bf1abdd-9e43-431c-ab1e-47f48344135a | 7 | private Instances subset(Instances insts, HotTestDetails test) {
Instances sub = new Instances(insts, insts.numInstances());
for (int i = 0; i < insts.numInstances(); i++) {
Instance temp = insts.instance(i);
if (!temp.isMissing(test.m_splitAttIndex)) {
if (insts.attribute(test.m_s... |
37417df7-e809-490c-a508-a634d8bb0d90 | 9 | @Override
public String getSingleFormalExpression() {
//filter the redundant elements
if(!this.getRemark().equals(InfoEnum.ElementRemark.NORMAL.name())){
return "";
}
String expression = null;
switch (InfoEnum.RequirementElementType.valueOf(this.getType())){
case ACTOR:
expression = "actor("+thi... |
3efdf3c6-c651-457d-beaf-756061779501 | 7 | public boolean addSpawnedMob(Player player, Mob mob, MobReference mobRef)
{
if (!mobRef.isValid())
return false;
// Fetch the players mob list
PlayerMobCounter limiter = playerMobs.get(player.getName());
// If the limiter doesn't exist create it
if (limiter == null)
playerMobs.put(player.getName... |
2726fd7b-6767-4a73-957b-94b95a07b93c | 1 | private boolean jj_2_15(int xla) {
jj_la = xla; jj_lastpos = jj_scanpos = token;
try { return !jj_3_15(); }
catch(LookaheadSuccess ls) { return true; }
finally { jj_save(14, xla); }
} |
0c0f3c5c-bc56-4ed9-8977-9d02de439619 | 3 | public void setTimeZone(double timeZone) {
if ((timeZone < -12) || (timeZone > 13)) {
throw new AssertionError((timeZone >= -12) && (timeZone <= 13));
}
_timeZone = timeZone;
} |
c2a0c6cf-3d1e-41c9-b656-021dbad0af42 | 5 | private int pileIndexToSendTo(Card toSendUp) {
List<List<Card>> topRow = game.getTopRow();
for (int i = 0; i < topRow.size(); i++) {
List<Card> pile = topRow.get(i);
if (toSendUp.getRank() == Card.Rank.ACE) {
//find empty
if (pile.isEmpty()) {
... |
8e5ce7d8-7634-4060-b330-58cbe3f593e4 | 8 | */
public void resetEdges(Object[] cells)
{
if (cells != null)
{
// Prepares a hashtable for faster cell lookups
HashSet<Object> set = new HashSet<Object>(Arrays.asList(cells));
model.beginUpdate();
try
{
for (int i = 0; i < cells.length; i++)
{
Object[] edges = mxGraphModel.getEdges(... |
e8e8c9e5-ef09-42e7-9580-6343273e4da4 | 7 | public static void main(String[] args) {
String s;
char[] c;
boolean check;
ArrayList<Integer> arr = new ArrayList<Integer>();
int result = 0;
for(int i = 999; i > 0; i--)
{
for(int j = 999; j > 0; j--)
{
s = "" + (i*j);
c = s.toCharArray();
check = true;
for(int x = 0; x < (c.len... |
186ff204-21ea-4741-8a61-a553e32c3e97 | 8 | public List<Namespace> getNamespacesIntroduced() {
if (getParentElement() == null) {
// we introduce everything... except Namespace.XML_NAMESPACE
List<Namespace> ret = new ArrayList<Namespace>(getNamespacesInScope());
for (Iterator<Namespace> it = ret.iterator(); it.hasNext(); ) {
Namespace ns = it.next(... |
9d308a17-48c6-45d6-863f-5ba9eae6b8dd | 8 | private void setAbondField(String str1, String str2, double x) {
if (!(model instanceof MolecularModel))
return;
MolecularModel m = (MolecularModel) model;
int lb = str1.indexOf("[");
int rb = str1.indexOf("]");
double z = parseMathExpression(str1.substring(lb + 1, rb));
if (Double.isNaN(z))
return;
... |
117f3337-367b-43f0-a793-4f7d9ea36e18 | 8 | private int[] initLineBreaks() {
int[] tmp = new int[inputChars.length];
if(inputChars.length==0) return tmp;
tmp[0] = -1;
int lineCnt = 1;
char prev = 0;
for (int i = 1; i != inputChars.length; i++) {
char ch = inputChars[i];
if ((ch == '\n' && prev != '\r') || ch == '\r'
|| ch == '\u0085' || ch ... |
9b3f50b6-ac4b-46a0-8315-2822e1556436 | 4 | default Iterator<Record> spliterator() {
return new Iterator<Record>() {
Optional<Record> nextData = Optional.empty();
@Override
public boolean hasNext() {
if (nextData.isPresent()) {
return true;
} else {
... |
aec1afa0-f756-4e8e-ade4-40da6406a1d3 | 1 | public void testColumnNameCount() {
DataSet ds = null;
try {
final TabDelimited testTab = new TabDelimited();
ds = testTab.getDsForTest();
// check that we parsed in the right amount of column names
assertEquals(5, ds.getColumns().length);
} ca... |
7a648de5-8fc3-47fd-88f2-cebb047a1c95 | 2 | public boolean SwapItem(Item selectedInListItem,Item fromSlotItem){
for(Item item : itemList){
if(item.compareName(selectedInListItem)){ // right item
}
}
return false;
} |
9251b33a-7803-45b9-afd3-fb6e779c924d | 7 | public static int check(int a, int b){
if(a==b)
return 0;
if(a==0&&b==2||a==2&&b==5||a==5&&b==0)
return 1;
return -1;
} |
7a99b08b-dd90-47a3-9725-74954918773c | 6 | private void parse_options( String line,
String keyword,
String[] split,
int lineNumber,
boolean strictMode )
throws ParseException {
// Line has the format:
// "Options" {+|-}<ModuleName>
if( split.length != 2 ) {
throw new ParseException( "Invalid '"+keyword+"' declaration at line " + lineN... |
6486c0a6-1f1c-413c-b15c-902427f8fde8 | 7 | public boolean compareAnswer(int[][] current)
{
int row = 0;
if(day <= 6)
{
while(row < 4)
{
for(int col = 0; col < 4; col++)
{
if(current[row][col] != entries4x4[row][col])
{
return false;
}
}
row++;
}
return true;
}
else
{
while(row < 9)
{
for... |
7380e658-b595-45e5-9e46-149e6874fd02 | 1 | public void deposit(int value) {
if(value >= 0) {
notifyPropertyChangeListeners(money, money + value);
money += value;
} else {
IllegalArgumentException ex = new IllegalArgumentException(
"You can't deposit a negative number of dollars!");
log.throwing(getClass().getSimpleName(), "deposit(int)", ex... |
06dad01c-0b13-459c-8714-73f20b09f00c | 2 | public static void main(String[] args)
throws IOException {
FileWriter outFile = new FileWriter("test01.txt");
PrintWriter out = new PrintWriter(outFile);
// Also could be written as follows on one line
// Printwriter out = new PrintWriter(new FileWriter(args[0]));
/... |
ef0b5b63-6304-4622-84f5-03c338136982 | 4 | public static void main(String[] args) throws IOException {
System.out.println("Welcome to Client side");
Socket fromserver = null;
if (args.length==0) {
System.out.println("use: client hostname");
System.exit(-1);
}
System.out.println("Connecting to... "+args[0]);
fromserver = ... |
996c0701-448a-43fb-9976-8d87104cb09a | 2 | public boolean accept(Vehicle d) {
if (d == null) { throw new IllegalArgumentException(); }
if (isDriveable(d) == Drivability.NotDriveable) return false;
_cars.add(d);
return true;
} |
1c2105c2-3827-4a10-b737-f8137b6e21f4 | 3 | public StringBuffer printSuperClass(Class<?> cls, StringBuffer message){
if(cls.getSuperclass() != null && !cls.getSuperclass().equals(Object.class)){
message.append(" extends " + cls.getSuperclass().getSimpleName());
}
return message;
} |
8fa9407b-803f-433a-91be-08f5a9679c9f | 8 | @EventHandler
public void onInventoryClose(InventoryCloseEvent event){
//We don't care about players other than the owner
if(!event.getPlayer().equals(owner))
return;
//We don't care about non-chest interactions
if(!event.getInventory().getType().equals(InventoryType.CHEST))
return;
if(event.getInvento... |
df8e7521-ff0c-46bb-801d-979dde1e9441 | 9 | public void actionPerformed(ActionEvent ae) {
//listener for popup menu
if ("Mark".equals(ae.getActionCommand()) || "Unmark".equals(ae.getActionCommand())) {
if ("Mark".equals(ae.getActionCommand())) {
chart.chartData.getEntryList().get(rightClicked).setIsMarked(true);
... |
93773172-c109-4f72-85c2-f1f430c46479 | 6 | public static Tile[] perimeter(Box2D area, World world) {
final int
minX = (int) Math.floor(area.xpos()),
minY = (int) Math.floor(area.ypos()),
maxX = (int) (minX + area.xdim() + 1),
maxY = (int) (minY + area.ydim() + 1),
wide = 1 + maxX - minX,
high = 1 + maxY - minY ;
///if... |
6119e8b1-ef55-4417-a50d-1dfeb3eeac37 | 5 | public final String getSelectedText()
{
if(selectionStart == selectionEnd)
return null;
if(rectSelect)
{
// Return each row of the selection on a new line
Element map = document.getDefaultRootElement();
int start = selectionStart - map.getElement(selectionStartLine)
.getStartOffset();
int e... |
398fdd28-4069-4e6d-bc73-640899b6d674 | 5 | private void mergeDynProp(Drawable prop, int offsetX, int offsetY) {
byte[] pixels = ((DataBufferByte)
screen
.getRaster()
.getDataBuffer())
.getData();
Rectangle r = prop.getBounds();
... |
9d181ed3-900c-4a2e-b600-c61a29762188 | 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... |
f763f3c0-e96f-4b78-a90d-b474538a606a | 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... |
8bac2e86-c485-4650-bcea-0d579a6a06ae | 2 | public static void closeQuietly(Closeable closeable) {
try {
if (closeable != null) {
closeable.close();
}
} catch (IOException ex) {
logger_.error("{}", ex);
}
} |
bb80ae7c-8a0b-43c3-a0da-67a7c468ebf6 | 5 | private void applyCourseFilters() {
filteredCourses.clear();
for (Source source : Source.values())
for (CourseRec rec : submodel[source.ordinal()].courses.values()) {
boolean passed = true;
for (int i = 0; i < filters.size() && passed; i++)
passed = filters.get(i).accept(rec);
if (passed)
f... |
176f133b-0cc4-4c59-be5f-7c0664868487 | 6 | public void createProjectile3(int casterY, int casterX, int offsetY, int offsetX, int gfxMoving, int StartHeight, int endHeight, int speed, int AtkIndex) {
for (int i = 1; i < Config.MAX_PLAYERS; i++) {
if (PlayerHandler.players[i] != null) {
Client p = (Client) PlayerHandler.players[i];
if (p.WithinDistan... |
f2969bd2-82d0-4ada-b57c-66241b555353 | 5 | public ListNode sortList1(ListNode head) {
ListNode node;
sortHead = head;
if (head == null) return head;
if (head.next == null) return head;
else sortTail = head.next;
if (sortTail.next == null) return head;
else node = sortTail.next;
if (sortTail.val ... |
cef70b44-137b-4aed-b139-a4435c49c62a | 5 | public static int getWireCountList(List<List<Gate>> gates) {
HashSet<Integer> hs = new HashSet<Integer>();
for (List<Gate> list: gates) {
for (Gate g: list) {
int leftIndex = g.getLeftWireIndex();
int rightIndex = g.getRightWireIndex();
int outputIndex = g.getOutputWireIndex();
if (leftIndex != I... |
6180da8f-e53b-464f-8f3b-1ec7dcf4aa18 | 2 | private void addIcon(String icon, int size) {
Pair<String, Integer> pair = new Pair<String, Integer>(icon, size);
icons.add(pair);
for (Channel channel : getChannels()) {
String add = PacketCreator.addIcon(channel.getName(), name, pair);
for (Client target : channel.getClients()) {
target.send(add);
... |
838ecea3-fbe1-4742-b498-69676fc0a75e | 2 | public synchronized int move() {
if (here == FLOORS - 1)
direction = -1;
else if (here == 0)
direction = 1;
there += direction;
return there;
} |
fa58e219-5eaa-4b47-839f-a940aa9790d3 | 2 | private int count(String s, char c) {
int count = 0;
int len = s.length();
for (int i = 0; i < len; i++) {
if (s.charAt(i) == c) {
count++;
}
}
return count;
} |
ab494527-a0c6-4db9-ba6b-9b351ed1eaa6 | 5 | @Override
public void executar() throws Exception
{
while ( true )
{
mostrarOpcions();
int choice = readint("\nOPCIO: ");
switch (choice)
{
case 1:
loginMenu.executar();
... |
b57a8ac5-f8b9-4b2e-bcda-10a72b6a79a6 | 7 | private void consumeComment(ParserReader input, StringBuffer text)
throws IOException {
// Need to match comment starts/ends
if(input.startsWith('*')) {
text.append('*');
int depth=0;
for(;;) {
final int commentCh = input.read();
text.append((char)commentCh);
if(commentCh == '*' && ... |
12f9ec89-9a7d-4aa2-8a09-385e8a4dbdb7 | 1 | public boolean matches( Class<?> clazz )
{
return Modifier.isPublic( clazz.getModifiers() );
} |
024ed96c-a4a0-4c6f-af9f-982b59fac89b | 9 | private void getCornerCloseness(int currentPlayer)
{
int mine = 0, his = 0;
for(int i = 0; i <= 1; ++i)
for(int j = 0; j <= 1; ++j)
if(board[i*(BOARD_SIZE-1)][j*(BOARD_SIZE-1)] == Empty)
{
/*
* X C
* A B
*/
int i1 = i*(BOARD_SIZE-1);
int j1 = j*(BOARD_SIZE-1);
... |
c777285e-c998-4efa-bfdc-67efb3643122 | 9 | @Test
public void testPieceFeeding() throws InvalidBEncodingException, IOException, TorrentException, MetaInfoException, NullHashException, BlockLengthException, WrongIndexException, NoSuchAlgorithmException {
MetaInfo metainfo = MetaInfoReader.openMetaInfo("trunk/data/LePetitPrince.torrent");
Torrent torren... |
fe91ced6-5e95-407f-b5ab-60f9b8174797 | 0 | public void removeFileDonwloadListener(FileDownloadListener listener){
listeners.remove(listener);
} |
b481425a-1683-4185-87eb-d5d301e8d814 | 9 | public boolean simpan(){
boolean adaKesalahan = false;
java.sql.Connection cn = null;
try{
Class.forName(Koneksi.driver);
} catch (Exception ex){
adaKesalahan = true;
JOptionPane.showMessageDialog(null,"JDBC Driver tidak ditemukan atau ru... |
9dc71e3d-248e-464d-8777-793edff34f54 | 5 | private static void collideFree( Sprite A , Sprite B , float ddx , float ddy )
{
if( ddx<ddy ) { if( A.x>B.x ){ A.x+=ddx/2; B.x-=ddx/2; } if( A.x<B.x ){ A.x-=ddx/2; B.x+=ddx/2; } }
else { if( A.y>B.y ){ A.y+=ddy/2; B.y-=ddy/2; } if( A.y<B.y ){ A.y-=ddy/2; B.y+=ddy/2; } }
} |
386f615c-3e32-4a4a-9643-304a91a4259f | 0 | public int getDirectionY(){
return directionY;
} |
a5c58bc3-3df9-4b76-a3ea-24a679565399 | 7 | public NumberDefinitionInfo(IntegerAttributeType att) {
super(att);
try {
String unit = null;
String unscaledUnit = "";
IntegerValueRange range = att.getRange();
if(range != null) {
unit = range.getUnit();
double conversionFactor= range.getConversionFactor();
if(conversionFactor != 1) {
... |
30e1d595-1cb6-47d3-9f4a-625c34841001 | 2 | public boolean isAValidPortNumber() {
try {
return args[1] != null && Integer.parseInt(args[1]) > 0;
} catch (ArrayIndexOutOfBoundsException e) {
return false;
}
} |
517293ce-e5bb-4f17-82f1-6b74a4c5050b | 1 | @Override
public void exchange(CorbaRoutingTable routingTable) {
if (routingTable == null) {
logger_.warn("Received an exchange request but was provided with a null CorbaRoutingTable object.");
return;
}
// a remote peer wants the local to execute the exchange algorit... |
c0499d79-fb4e-4fd7-8f1c-ec5de09a44d8 | 8 | private void updateWaterOpacity() {
byte opacity = 3;
if (this.ofClearWater) {
opacity = 1;
}
Block.waterStill.setLightOpacity(opacity);
Block.waterMoving.setLightOpacity(opacity);
if (this.mc.theWorld != null) {
IChunkProvider cp = this.mc.theWo... |
0fdf3742-299c-4e64-b5ea-c214bb8916e6 | 1 | private void loadContent() {
try {
img_missile = ImageIO.read(this.getClass().getClassLoader().getResource("img/missile.png"));
} catch (IOException e) {
e.printStackTrace();
}
} |
d2068533-7e23-4072-a1c6-6ec43cd4f930 | 1 | protected boolean fireReceiveExceptionEvent(ExceptionEvent evt) {
if (receiveException != null) {
return receiveException.OnReceiveExceptionEvent(evt);
}
else {
return false; //needDisconnect
}
} |
adc0c754-ec05-49e0-9187-33f1d52229d1 | 4 | public int getMaxHeight() {
if(caching && !maxHeightDirty) return _maxHeight;
maxHeightDirty = false;
int max = 0;
for (int i = 0; i < width; i++) {
if (getColumnHeight(i) > max)
max = getColumnHeight(i);
}
return (_maxHeight = max);
} |
93ee2579-6deb-4a5f-83b5-79db75c2c161 | 0 | private Bank()
{
} |
0837e103-987f-4f8d-82d2-13260bd69886 | 8 | public static ArrayList<Note> createTabNumbers(ArrayList<Note> list, int min, int max) {
// Min and max cannot be negative numbers
if (min < 0 || max < 0) {
return null;
}
// Create the temporary ArrayList that will be returned
ArrayList<Note> notesList = new ArrayList<Note>(list.size());
... |
ba0d3163-38da-47f5-9de7-633a12c3a4ee | 1 | public static void main(String args[]) throws FileNotFoundException {
File[] files = FileLister.getFilesArrayFile();
int selection = FileChooser.chooseFile();
Scanner in = new Scanner(files[selection]);
while(in.hasNextLine()) {
String inLine = in.nextLine();
System.out.println(inLine);
}
} |
ea850ab7-5ea4-424a-a727-7219b3efebea | 3 | private static EnumOS determineOS()
{
if (CompInfo.VENDOR.equalsIgnoreCase("The Android Project"))
{
return ANDROID;//Still feel rather crummy for this...
}
String os = System.getProperty("os.name").toLowerCase();
for (EnumOS potenOS : values())
{
if (os.startsWith(potenOS.toString()))
{
... |
d8704440-a1e1-40ae-b467-0f385f27e65d | 5 | @Override
public Rights getRights(String songId,
String categoryId) throws ProfileExceptions {
if (songId == null || songId.isEmpty())
throw new ProfileExceptions(ProfileExceptionType.EmptyString);
if (categoryId == null || categoryId.isEmpty())
throw new ProfileExcepti... |
e991a6ec-3135-473b-87a6-28c2414f8642 | 2 | public PersonalEventResponseList postPersonalEvents(String asUserId,
PersonalEventList aaList) {
if (asUserId == null || asUserId.trim().length() == 0) {
throw new IllegalArgumentException("userId is null");
}
return post(REST_... |
cb3f4afb-6168-4364-a72c-388551f064c0 | 7 | public boolean isTop( int row, int column ) {
if ( row < 0 || column < 0 || row > 5 || column > 6 ) {
return false;
}
if ( _board[row][column] == 0 && ( (row + 1) > 5 || _board[row+1][column] != 0)) {
return true;
}
return false;
} |
c89a2651-db6e-47f2-80f9-f376d4b83404 | 1 | public AdaBoost() throws IOException{
Features feat = new Features(100, 100);
feat.integralImages(feat.FACES, feat.numbFaces, feat.integralFaces);
System.out.println(new Date() + "--- Integralfaces. Done");
feat.integralImages(feat.NONFACES, feat.numbNonFaces, feat.integralNonFaces);
System.out.println(new Da... |
9fca08a8-6668-4f29-ae3b-81365222f093 | 7 | public static String doubleToString(double d) {
if (Double.isInfinite(d) || Double.isNaN(d)) {
return "null";
}
// Shave off trailing zeros and decimal point, if possible.
String string = Double.toString(d);
if (string.indexOf('.') > 0 && string.indexOf('e') < 0 &&
... |
fab3b56b-8a36-4c6b-8886-a85bedb16b91 | 5 | public void refresh(final Application app) {
artists = app.getAllArtists();
if (artistList.getSelectedIndex() != -1) {
int select = albumList.getSelectedIndex();
albums = artists.get(artistList.getSelectedIndex()).getAlbums();
/**
* SetContent for AlbumList
*/
albumList.setModel(new AbstractList... |
fac61719-8a6d-4ca1-9c1c-035943018501 | 3 | private void initGraphics() {
Font.loadFont(getClass().getResourceAsStream("/eu/hansolo/enzo/fonts/opensans-semibold.ttf"), (0.06 * PREFERRED_HEIGHT)); // "OpenSans"
sectionsCanvas = new Canvas(PREFERRED_WIDTH, PREFERRED_HEIGHT);
sectionsCtx = sectionsCanvas.getGraphicsContext2D();
... |
1fa94eaf-df6a-43df-8f7c-10f0fe7f77d0 | 3 | public void DoAction() {
viewTo(destinationX, destinationY);
switch (ActionType) {
case 1: // Object click 1
objectClick(destinationID, destinationX, destinationY, 0, 0, 1);
break;
case 2: // Object click 2
objectClick2(destinationID, destinationX, destinationY);
break;
case 3: // Object click 3
... |
1002f529-915c-4ed8-a9ce-2d296738c09d | 3 | public void toFile(Path outputPath, Boolean printHeader) {
List<String> outputList = new ArrayList<>();
if (printHeader) {
outputList.add(this.header.toCSVString());
}
this.records.forEach(e -> outputList.add(e.toCSVString()));
try {
Path path = Files.w... |
fda467d9-14cc-42f6-b4ed-59db22e45062 | 0 | protected int getBreedingAge()
{
return BREEDING_AGE;
} |
3f0786da-bf9d-4360-9341-dd994fca3596 | 7 | @Override
public void executeMsg(final Environmental myHost, final CMMsg msg)
{
super.executeMsg(myHost,msg);
if((invoker==null)||(!(affected instanceof MOB)))
return;
if(msg.amISource((MOB)affected)
&&(msg.targetMinor()==CMMsg.TYP_DAMAGE)
&&(!msg.amITarget(affected))
&&(msg.tool() instanceof Weapon)
... |
b85b331a-06e7-4b11-b1d1-9169a5f0b4cc | 3 | public SpelprojektPanelViewbox(String sid, String beteckning, String release, String start) {
initComponents();
if (Validate.containsOnlyDigits(sid)) {
this.sid = Integer.parseInt(sid);
} else {
this.sid = -1;
}
SimpleDateFormat sdf = new SimpleDateFormat(... |
bdeac7d2-3b36-43bd-97c3-218e84c7d22d | 5 | public Door popDoorFromCoords(int areaX, int areaY, int x, int y) {
for (Door e : doorAreas[areaY][areaX]) {
if ((x <= e.x + 1) && (x >= e.x) && (y <= e.y + 1)
&& (y >= e.y)) {
doorAreas[areaY][areaX].remove(e);
return e;
}
}
return null;
} |
4b32eb38-4486-41b8-8261-0737e23b57ab | 6 | public Rectangle2D execute(PDFRenderer state) {
Rectangle2D rect = null;
if ((style & FILL) != 0) {
rect = state.fill(gp);
GeneralPath strokeagain = checkOverlap(state);
if (strokeagain != null) {
state.draw(strokeagain, againstroke);
}
... |
9f1ab803-6594-45e6-b56e-09fcf1305d8b | 4 | public Action choose(Reversi.Player actor, Set<Action> options) {
// If all we can do is pass, go for it.
if (options.size() == 1) {
return first(options);
}
// Otherwise, greedily select the move that
// captures the most enemy pieces in the next turn.
Reversi.Move best = (Reversi.Move)firstOfType(Reve... |
2b33cb19-74a0-40b5-a50f-fe7624d764a3 | 7 | public boolean start() {
synchronized (optOutLock) {
// Did we opt out?
if (isOptOut()) {
return false;
}
// Is metrics already running?
if (task != null) {
return true;
}
// Begin hitting the s... |
0e316a5f-1ee6-4f50-92cf-8831713b0d4b | 1 | @Override
public void channelDisconnected(ChannelHandlerContext ctx,
ChannelStateEvent e) throws Exception {
super.channelDisconnected(ctx, e);
if (listener != null) {
listener.disconnected();
}
} |
3a2c523b-3b73-4cd1-8e85-db1c80d5d0d0 | 9 | private String className(Symbol sym, boolean longform) {
if (sym.name.isEmpty() && (sym.flags() & COMPOUND) != 0) {
StringBuilder s = new StringBuilder(supertype_field.toString());
for (List<Type> is=interfaces_field; is.nonEmpty(); is = is.tail) {
... |
e3ae7882-aa53-43c8-a322-9ae7de3ff518 | 3 | @WebMethod(operationName = "ReadTransDetail")
public ArrayList<TransDetail> ReadTransDetail(@WebParam(name = "trans_det_id") String trans_det_id) {
TransDetail trans_det = new TransDetail();
ArrayList<TransDetail> trans_dets = new ArrayList<TransDetail>();
ArrayList<QueryCriteri... |
605b3261-b360-4e09-969d-a1077e987558 | 8 | public void handleEndGame(boolean hasWon){
int val;
String name = null;
if (hasWon){
timer.stop();// pause timer
if (timeElapsed < scores.get(9).time)
name = JOptionPane.showInputDialog(this, "New High: " +
String.format("%.2f",timeElapsed) + ". What's your name?");
if (name != null && !name.... |
9cf9d8fb-163c-4866-a21b-1d8339f1dc61 | 0 | public static AnswerSideManager getInstance()
{
return instance;
} |
1dfaf8db-7cdb-423f-87b2-94e251130da8 | 7 | private static String buildQuery( MultiMap<String,String> query ) {
if ( query == null || query.isEmpty( ) )
return null;
StringBuilder sb = new StringBuilder( );
boolean first = true;
for ( String key : query.keySet( ) ) {
for ( String value : query.get( key ) ) {
if ( !first )
sb.appe... |
0b7c09d1-7375-4f7c-9868-3ac4479bbe98 | 4 | public ItemTable() {
super(new ItemTableModel());
makeSettingColumn();
setAutoCreateRowSorter(true);
setFillsViewportHeight(true);
setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);
addMouseListener(new ItemTableMouseListener());
setDragEnabled(true... |
da5c467f-6c38-4388-88d0-716a765bc0c5 | 9 | public static ContactDetails getContactDetails(String contactID,int mode){
ContactDetails contactDetails = null;
AddressBook addressBook = Helpers.getAddressBook();
if (addressBook == null) {
System.out.println("getContactDetails - addressBook returns null");
return null;... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.