method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
24d1a716-123c-495b-b7ec-699fbe56f8f6 | 0 | public AlgorithmIdentifierType getKeyDerivationFunc() {
return keyDerivationFunc;
} |
72b83d74-49c1-4ee5-8ab2-2c886cd50864 | 1 | static double avgValueInArray(int[] N) {
double sum = 0;
int n = N.length;
for (int i = 0; i <= n; i++) {
sum += N[i];
}
return sum/n;
} |
bd68390e-cb97-4ca9-9860-8a95d029af40 | 9 | @Override
public Object getValueAt(int rowIndex, int columnIndex) {
int index = rowIndex + startingIndex;
// if(columnIndex == 0);
// System.out.println("Value queried at " + index);
if(index >= teams.size())
return null;
Team team = teams.get(index);
switch (columnIndex) {
case 0:
return index + 1;... |
a4c9096c-9e96-4505-8723-774828ee46d4 | 8 | public static Hashtable<Node, Integer> getLargestConnectedSubgraph(GraphEltSet ges) {
int nodeCount = ges.nodeCount();
if (nodeCount == 0)
return null;
Vector<Hashtable<Node, Integer>> subgraphVector = new Vector<Hashtable<Node, Integer>>();
for (int i = 0; i < nodeCount; i++) {
Node n = ges.nodeAt(i);
... |
95f320e0-a136-4802-9c62-4c44f0745cf3 | 1 | private void redefineSize() {
Dimension d = new Dimension(1, 1);
if (myImage != null) {
d = new Dimension(getImage().getWidth(this), getImage().getHeight(
this));
}
setPreferredSize(d);
setBounds(-myOrigin.x, -myOrigin.y, d.width, d.height);
} |
f85b1665-d833-40da-9358-c939108b07fe | 1 | private void setHighScore(){
FileWriter output = null;
try{
File f = new File(saveDataPath, fileName);
output = new FileWriter(f);
BufferedWriter writer = new BufferedWriter(output);
writer.write("" + highScore);
writer.close();
}
catch(Exception e){
e.printStackTrace();
}
} |
94f1d7cf-4d75-4a94-a34d-b5d830cb5208 | 8 | private static final String[] getNamesInternal(Map props) {
String[] all = new String[] {
Registry.SASL_SRP_MECHANISM,
Registry.SASL_CRAM_MD5_MECHANISM,
Registry.SASL_PLAIN_MECHANISM,
Registry.SASL_ANONYMOUS_MECHANISM
};
if (props == null) {
return all;
... |
7d6b8188-3109-4a35-9899-e58e33a2d379 | 6 | public int[][] generateMatrix(int n) {
int[][] result = new int[n][n];
int input = 1;
int size = n;
int shift = 0;
while(size - (shift+1) * 2 >= 0){
for(int i=shift; i<size-1-shift; i++){
result[shift][i] = input++;
}
for(int i=... |
451b5725-9052-4af0-ac17-907f681dcc0c | 7 | public GameMatter getItem(Face face){
if (corruptedTemplate){
//template is bad/incomplete, return null.
return null;
}
//===start generating dimensions & value===
int value, scale, x, y = 0;
double r = random.nextDouble();
value = (int) (valueMin + (valueRange * r));
scale = (int) (sizeMin + (size... |
50556f4e-9e59-4712-973e-7ae958f11e75 | 6 | @Override
protected Value evaluate(ExecutionContext context) throws InterpretationException {
Value val1 = ((AbsValueNode) this.getChildAt(0)).evaluate(context);
Value val2 = ((AbsValueNode) this.getChildAt(1)).evaluate(context);
Value val3 = ((AbsValueNode) this.getChildAt(2)).evaluate(con... |
55419c48-c17d-43b6-97b5-d885476fc2da | 0 | public int getVal() {
return val;
} |
86fa482c-259e-49e1-9581-0d1dad15d344 | 1 | public String getColumnName(int col) {
try {
return project.getColumnName(col);
} catch (Exception err) {
return err.toString();
}
} |
c4809826-52dc-409d-8a89-88fb9350390c | 3 | private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {
_username = usernameField.getText();
_password = new String(passwordField.getPassword());
if (!_username.isEmpty() && !_password.isEmpty()) {
clickedOKButton = true;
setVisible(false);
try {
... |
bfe2106a-9d93-44d2-9562-33faf0ced6f4 | 2 | @Override
public ArrayList<Product> searchByKeywords(String[] keywords) {
if (keywords.length == 0) return new ArrayList<Product>();
// TODO there must be a better way !
String sql = "SELECT * FROM product WHERE ";
for (String keyword : keywords) {
sql += "product_name ILIKE '%" + keyword
+ ... |
f3ae04f5-a218-41a3-9d65-d85ce54e041f | 2 | public Matrix(int new_width, int new_height) throws MatrixError {
width = new_width;
height = new_height;
verifySize();
array2d = new int[height][width];
lengths2d = new int[height][width];
for (int i=0; i<width; i++) {
for (int j=0; j<height... |
f6e9fdcb-b854-4079-b0c4-469370c4e1cc | 9 | public void testNull()
{
System.out.println("\nStarting testNull: tasks");
try
{
new Task(null, john, jane);
fail("Illegal Argument Exception expected!");
}
catch (IllegalArgumentException iae)
{
}
try
{
new Task(title, null, jane);
fail("Illegal Argument Exception expected!");
}
... |
f589f90d-72c6-4265-99dd-6e479bb2251b | 4 | private static int findMeADivisor(int num) {
for (int prime : some_primes)
if (num % prime == 0)
return prime;
//otherwise...
System.out.println("I've had to bruteforce it...");
for (int i = some_primes[some_primes.length - 1] + 1; i < num; i... |
29fc1b45-f277-4348-9edc-ff2a1614005f | 7 | public <T extends BusinessObject> void save(T bo) throws DataException {
// reset the cache timer
Cache.getInstance().put(bo.getId(), bo);
// if the object isn't dirty, don't bother saving
if (!bo.isDirty()) {
return;
}
// save in the database
Connection conn = ConnectionPool.getInst... |
5a9f4047-9625-445e-b45c-3aca0883361e | 6 | public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int nextPrime = 2; //first prime
int n = 1; //sequential number of a prime number
System.out.printf("%d. prime number is %d\n\n", n, nextPrime);
while (true) {
System.out.print("Do you want to continue(y/n)? "); //user input
... |
afd396b8-13cb-4f69-8fbb-47405b787d6a | 9 | @Override
public void onChatComplete(Player player, String reason, Object... args) throws EssentialsCommandException {
// determine whether we're banning or unbanning
if(args.length == 2) {
// banning
// determine if its an IP or not
if(args[0] instanceof ArrayList<?>) {
// get everyone on our list
... |
ad3e11cf-2095-4930-a8a3-dcc9caba9356 | 0 | public static int getSection(int y){
return y/16;
} |
ce538b27-af64-41f3-892a-e085236c098c | 1 | protected IDocument createDocument(Object element) throws CoreException {
IDocument document = super.createDocument(element);
if (document != null) {
IDocumentPartitioner partitioner =
new FastPartitioner(
new CoffeescriptPartitionScanner(),
new String[] {
CoffeescriptPartitionScanner.COMMENT... |
03aeedd8-6219-4758-999a-faf06256460e | 5 | public static void main(String[] args) throws FileNotFoundException {
JFileChooser chooser = new JFileChooser(new File(System.getProperty("user.dir"))); // Create the FileChooser instance
int returnVal = chooser.showOpenDialog(null);
GameOfLife gol;
if(returnVal != JFileChooser.APPROVE_OPTION)
gol = new ... |
0ffaf6d3-d9b4-4873-be6f-39ba8eed4a5e | 6 | @Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
Pagamento other = (Pagamento) obj;
if (codigo == null) {
if (other.codigo != null)
return false;
} else if (!codigo.equals(other.codigo)... |
1f240567-b14e-40d7-8b34-1fb8cd0570d7 | 1 | public List<String> getPileLogiciel() {
if (pileLogiciel == null) {
pileLogiciel = new ArrayList<String>();
}
return this.pileLogiciel;
} |
19d95a8c-d097-4fe0-a3c0-ac472a7dfd06 | 9 | public static boolean batch( WebSocketImpl ws, ByteChannel sockchannel ) throws IOException {
ByteBuffer buffer = ws.outQueue.peek();
WrappedByteChannel c = null;
if( buffer == null ) {
if( sockchannel instanceof WrappedByteChannel ) {
c = (WrappedByteChannel) sockchannel;
if( c.isNeedWrite() ) {
... |
3d424b9c-6665-4a2c-a161-82b8c9b382fc | 6 | public static List<NetworkInterface> getNetworkInterfaceList() {
List<NetworkInterface> networkInterfaceList = new ArrayList<NetworkInterface>();
try {
for (Enumeration<NetworkInterface> interfaces = NetworkInterface
.getNetworkInterfaces(); interfaces.hasMoreElements();) {
NetworkInterface networkInter... |
d2eb3c9f-a5c6-47ef-a9f4-f2fd84b81434 | 8 | private void drawTriangle(Triangle3D tria) {
if (tria == null) return;
Point3DOdn a = convPToScreen(tria.getV1());
Point3DOdn b = convPToScreen(tria.getV2());
Point3DOdn c = convPToScreen(tria.getV3());
int sy, x1, x2;
boolean flag = true;
// здесь сортируем вершины (A,B,C)
while (flag) {
flag = false;
... |
a261b2cc-2418-4175-96fb-a244ccb476de | 4 | public boolean checkSame(char[] ArrOfMove) {
int x;
boolean same = true;
for(x=0; (x<(ROWCOL-1)&&(same)); x++){
if(ArrOfMove[x] == ArrOfMove[x+1]) {
if(ArrOfMove[x]!=BLANKS){
same = true;
} else {
same = false;
}
} else {
same = false;
}
}
return same;
} |
70d94eca-ae12-4abd-ba50-a6331997a7bb | 4 | public Source(HtmlMidNode parent, HtmlAttributeToken[] attrs){
super(parent, attrs);
for(HtmlAttributeToken attr:attrs){
String v = attr.getAttrValue();
switch(attr.getAttrName()){
case "media":
media = Media.parse(this, v);
break;
case "src":
src = Src.parse(this, v);
break;
... |
ba9acac8-e838-4277-b31d-c45efd335d41 | 1 | @Override
public boolean equals(Object object) {
if (!(object instanceof CycNumber)) {
return false;
} else {
return this.getNumber().equals(((CycNumber) object).getNumber());
}
} |
5d94b619-6a0b-40b2-ba5d-79ea948409e9 | 2 | private static SpriteSheet getSpriteSheet(String path, float scale) {
try {
SpriteSheet spriteSheet;
Color col = new Color(0, 0, 255);
Image img = new Image(path);
if (scale != 1) {
img = img.getScaledCopy(scale);
}
img.set... |
b5b0bdd8-bbb4-4353-acf7-e8d5149c40cc | 7 | @Override
public double timeToReach(Node startNode, Node endNode, Message msg) {
// TODO Auto-generated method stub
double dist = startNode.getPosition().distanceTo(endNode.getPosition());
/* Link rate | time arrive mSec | dist
* ----------------------------------------------------
* 11 | 2542 | 399
... |
b6c841e5-e233-44be-8467-995d4050b91d | 5 | protected void skipSpaces() throws IOException
{
for (;;)
{
switch (current)
{
default:
return;
case 0x20:
case 0x09:
case 0x0D:
case 0x0A:
}
current = reader.read();
}
} |
7498304c-de1c-4bd2-824e-6d6bbfedefea | 1 | public void makeNonVoid() {
if (type != Type.tVoid)
throw new alterrs.jode.AssertError("already non void");
type = subExpressions[0].getType();
} |
5ca742a4-3741-43d8-93a6-64e2c8c3d3d5 | 3 | private void handleLoad() {
boolean loaded = false;
Bot bot = null;
Object o = forFile(botFile);
if (o instanceof Bot) {
bot = (Bot) o;
String msg = String.format(
"Are you sure you want to load '%s'?", bot.getName());
loaded = showDialog(msg, "Are you sure?") == 0;
}
if (loaded && b... |
251002a6-bee7-4552-a5a4-088a098690b1 | 5 | @Override
public Calendar plan(ArrayList<Calendar> calendars, TaskList tasklist, String calendarName) throws PlanningException {
ZonedDateTime last = tasklist.getLastDeadline();
ZonedDateTime now = ZonedDateTime.now();
Calendar merged = PlanningUtil.mergeCalendars(ApplicationSettings.getInstance().getLocalizedMe... |
775c5654-ae44-4d3e-9dcc-953b33f21556 | 8 | private void setParameter(List<Object> values, PreparedStatement ps)
throws SQLException {
for (int i = 1; i <= values.size(); i++) {
Object fieldValue = values.get(i - 1);
Class<?> clazzValue = fieldValue.getClass();
if (clazzValue == String.class)
ps.setString(i, (String) fieldValue);
else if (cl... |
9667220b-b6fd-4dc0-b16a-02905210c7f2 | 9 | public Updater(Plugin plugin, int id, File file, UpdateType type, boolean announce) {
this.plugin = plugin;
this.type = type;
this.announce = announce;
this.file = file;
this.id = id;
this.updateFolder = plugin.getServer().getUpdateFolder();
final File pluginFile... |
8eca2c73-2358-4d1c-b7b3-7bbae063db3e | 3 | public boolean equals(Object var1) {
if(this == var1) {
return true;
} else if(var1 != null && this.getClass() == var1.getClass()) {
J_JsonNumberNode var2 = (J_JsonNumberNode)var1;
return this.field_27225_b.equals(var2.field_27225_b);
} else {
return false;
}
... |
454667cf-1a06-4929-a0af-9e7d35e2d7e8 | 5 | private void findMin() {
if(calibrationDataSize > 0) {
int index = 0;
while(!calibrationFlag[index]) {
index++;
}
min = data[index];
index++;
for(int i=index; i<data.length; i++) {
if(calibrationFla... |
74b674f6-97c3-4f61-8663-f94c09def7b7 | 5 | protected void changeBounds(Component source, int direction, Rectangle bounds, Point pressed, Point current) throws Exception {
// Start with original locaton and size
int x = bounds.x;
int y = bounds.y;
int width = bounds.width;
int height = bounds.height;
// Resizin... |
c36d431a-1cf7-4941-8f3c-4a9a81b56431 | 3 | @Override
public int doEndTag() throws JspTagException {
try {
if (msg != null && !msg.isEmpty()) {
JspWriter out = pageContext.getOut();
out.write("</div>");
}
} catch (IOException e) {
throw new JspTagException(e.getMessage());
... |
59b5c20b-6b81-4d4a-b356-8d230c11d00f | 4 | public DecodedDouble(double value) {
final long longBits = Double.doubleToLongBits(value);
sign = decodeDoubleSign(longBits);
final int rawExponent = decodeDoubleExponent(longBits);
final long rawMantissa = decodeDoubleMantissa(longBits);
if (rawExponent > 0 && rawExponent < 2047) {
... |
4c12141a-a98e-40b6-a993-770dde47c3d8 | 5 | boolean isMaxHeap(int i)
{
if (2 * i > N) // no children
return true;
// Not a max heap if parent is lesser than its children
if (less(pq[i], pq[2 * i])
|| ((2 * i + 1 <= N) && less(pq[i], pq[2 * i + 1])))
return false;
// Recursively test for left and right subheaps
return (isMaxHeap(2 * i) ... |
f9dd844c-a0cd-4b4a-9a49-5a59bacd1501 | 7 | Vector<Integer> getSortedHexagonNeighbors(int cellId) {
Vector<Integer> neighbors = getNeighbors(cellId);
if ((cellId == 0) || (cellId == countCells() - 1)) {
// The poles' neighbors are already sorted.
return neighbors;
}
Vector<Integer> result = new Vector<>(6... |
624f9815-22ad-41fd-8b38-6ab585444d04 | 0 | public void removeModel(AbstractModel model) {
registeredModels.remove(model);
model.removePropertyChangeListener(this);
} |
a81d5c79-fc64-4f11-80f9-5f6218ab9577 | 0 | public boolean isRight() {
return right;
} |
67ca4302-c8f4-43d5-a024-7dfd83254848 | 7 | @Override
protected void updateItem(String item, boolean empty) {
super.updateItem(item, empty);
if(empty) {
setText(null);
setGraphic(null);
} else {
setText(getString());
setGraphic(getTreeItem().getGraphic());
if(getItem().equals(serverName.getText())
&& getConnectButtonText(... |
ac6d3dc8-0418-4993-9956-f568a0ae110a | 7 | private void describeSkills(Description d, HUD UI) {
//
// Describe attributes, skills and psyonic techniques.
d.append("Attributes: ") ;
for (Skill skill : traits.attributes()) {
final int level = (int) traits.traitLevel(skill) ;
final int bonus = (int) traits.effectBonus(skill) ;
d.... |
64c3b89c-9abb-4b89-8121-31ffa7ce960e | 6 | private void tryAllLines() {
for(int i = 0; i < getGameSize(); i++)
tryLine(0, i, ELine.HorizontalLine);
for(int i = 0; i < getGameSize(); i++)
tryLine(i, 0, ELine.VerticalLine);
for(int i = 0; i < (getGameSize() - getWinLength() + 1); i++)
tryLine(0, i, ELine... |
71cbd4af-06d8-4341-bf4e-ebd04ec929d0 | 9 | private long getTemplateFolderIdFromPath(final long groupId, long folderId, final List<String> templateFoldersArray,
final ServiceContext serviceContext) {
if (templateFoldersArray.size() > 0) {
DLFolder folder = null;
try {
folder = DLFolderLocalServiceUtil.g... |
fd6e4387-77da-4e01-8a35-76ed04414678 | 0 | void exit() {
dispose();
System.exit(0);
} |
8e929774-92fd-48a4-909e-bcc81a6ccc82 | 5 | @command
public void Null(CommandSender sender, String[] args) {
tickets = plugin.getTicketHandler();
if (sender instanceof Player) {
Player p = (Player) sender;
if (args.length == 0) {
if (sender.hasPermission("modreq.status")) {
try {
... |
38425248-60b0-432a-9149-5f07576b69c9 | 9 | @SuppressWarnings("unchecked")
void formul() {
String groupName = parseToken(line, 12, 15);
String formula = parseTrimmed(line, 19, 70);
int ichLeftParen = formula.indexOf('(');
if (ichLeftParen >= 0) {
int ichRightParen = formula.indexOf(')');
if (ichRightParen < 0 || ichLeftParen >= ichRig... |
9f4bb6e6-3f1e-4171-9a96-c991faf7fbcc | 0 | public int size( )
{
return IntBTNode.treeSize(root);
} |
d8caf747-aa26-4cbf-b7f3-8b7130de7c14 | 3 | public static String resolveCookie(HttpServletRequest httpRequest, String authCookieName) {
Cookie[] cookies = httpRequest.getCookies();
if (null != cookies) {
for (int i = 0; i < cookies.length; i++) {
Cookie c = cookies[i];
if (c.getName().equals(authCookieName)) {
... |
3b4489d3-16a5-42ba-9741-f27d2af9697c | 7 | public static void main(String args[]) throws Exception {
final int testCount = 1000 * 100 * 20;
CopyBean bean = getBean();
// BeanMapping copy测试
final CopyBean beanMappingTarget = new CopyBean();
final BeanCopy beanCopy = BeanCopy.create(CopyBean.class, CopyBean.class);
... |
ba89a0e9-6298-48bc-b646-281b547cb908 | 7 | private static void loadUnpackedNPCBonuses() {
Logger.log("NPCBonuses", "Packing npc bonuses...");
try {
DataOutputStream out = new DataOutputStream(new FileOutputStream(
PACKED_PATH));
BufferedReader in = new BufferedReader(new FileReader(
"data/npcs/unpackedBonuses.txt"));
while (true) {
St... |
64573eb4-3956-4a2d-b4e9-5233fea10e6f | 2 | @Override
public void timeStep(TimeEvent e) {
time = MathUtils.clamp(time + e.getDelta(), 0, duration);
if(tweenOut) {
offset.setX(MathUtils.easeOut(time, 0, -distance, duration));
} else {
offset.setX(MathUtils.easeOut(time, -distance, distance, duration));
}
if(time == duration) {
time = ... |
2a7a56ea-295b-4618-936f-42654224a381 | 7 | @Override
public String toString() {
StringBuilder buffer = new StringBuilder(); // output buffer
try {
buffer.append(this.isDhcp ? "DHCP Packet" : "BOOTP Packet")
.append("\ncomment=")
.append(this.comment)
.append("\naddress=")
... |
28529b76-4c30-4a0d-9162-b9ade70a0c59 | 0 | public String getDescription() {
return "*.txt";
} |
5fb05abe-dcaa-43ce-9f7b-74bbe5df0e88 | 8 | public JSONArray requestMeta() throws IOException {
if (socket == null) {
throw new IllegalStateException("No open connection!");
}
logger.debug("Requesting meta file ");
String message = ConnectionMessages.SERVER_META_DOWNLOAD;
// Write message
socket.getOut... |
dde3a96a-aa31-4f45-81ad-fb9b4d5bcfee | 5 | public TreeNode sortedListToBST(ListNode head) {
TreeNode median;
if (head == null) {
return null;
} else if (head.next == null) {
return new TreeNode(head.val);
}
// else if(head.next.next == null){
// //ListNode next = head.next;
// median = new TreeNode(head.next.val);
// head.next = null;
//... |
1b55581b-099f-4fb7-b5d4-3b4d633ef6ff | 1 | public static void main(String[] args) throws IOException {
StaticDynamicUncertaintyULHSolver solverWithoutADI = new StaticDynamicUncertaintyULHSolver();
StaticDynamicUncertaintyWithADIULHSolver solverWithADI = new StaticDynamicUncertaintyWithADIULHSolver();
SinodialSeasonNormalDistributedProblemGenerator problem... |
f006086f-a282-4f9f-bfbf-164488fd7f91 | 4 | public Point collisionDetection(Rectangle hitbox) {
collisionData.clear();
Rectangle copy = (Rectangle) hitbox.clone();
for (int i = 0; i <= 40; i++) {
for (int j = 0; j <= 24; j++) {
if (tiles[i][j] == Tiles.WALL) {
Rectangle temp = new Rectang... |
7edc9216-83af-4b3a-af35-cba51809092e | 6 | public static String decodeUTF8(String s) {
if (s == null)
return "";
StringBuffer sb = new StringBuffer();
for (int i = 0; i < s.length(); i++) {
char c = s.charAt(i);
switch (c) {
case '+':
sb.append(' ');
break;
case '%':
try {
// 将16进制的数转化为十进制
sb.append((char) Integer.par... |
1515d42b-2a4d-4fed-8984-e7d97182b638 | 2 | private Map<String, Class> getBusinessObjectFields(Class boClass) throws Exception {
Map<String, Class> fields = new TreeMap<String,Class>();
for (Field field: boClass.getDeclaredFields()) {
if (field.getAnnotation(BusinessObjectField.class) != null) {
fields.put(field.getName(), field.getType());... |
a2a63c49-0b0c-4c26-895c-bc2dc2653fd7 | 3 | @Override
protected Dimension getSizeSelf(LayoutSize type) {
int width = mWidth;
int height = mHeight;
if (type == LayoutSize.MAXIMUM) {
if (mGrowWidth) {
width = Integer.MAX_VALUE;
}
if (mGrowHeight) {
height = Integer.MAX_VALUE;
}
}
return new Dimension(width, height);
} |
b8876873-9ba8-406b-b270-69324c7e567e | 3 | private void display(String rest)
throws IOException, SQLException, SyntaxException {
// setOutputMode(OutputMode.t);
if (rest.equals("t")) {
// Display list of tables
DatabaseMetaData md = conn.getMetaData();
ResultSet rs =
md.getTables(null, null, "%", new String[]{"TABLE","VIEW"});
textDecora... |
dd61989c-b96c-4015-8c01-789ec0f36999 | 8 | @Override
public void actionPerformed(ActionEvent e){
// TODO Auto-generated method stub
//action of button search
if(e.getSource()==start){
try {
new startTest();
} catch (IOException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
}
//action of ... |
7172e281-034b-459d-ab13-9a808313a168 | 1 | public static TimerPreferences getInstance()
{
if (instance == null)
{
instance = new TimerPreferences();
}
return instance;
} |
a5f6a503-1493-41b8-b8f7-2f22338170a2 | 4 | public static void LookAndFeel(Color c) {
try {
for (UIManager.LookAndFeelInfo info : UIManager
.getInstalledLookAndFeels()) {
if ("Nimbus".equals(info.getName())) {
UIManager.setLookAndFeel(info.getClassName());
UIManager.getLookAndFeelDefaults().put(
"ComboBox:\"ComboBox.listRenderer\... |
d81716fc-3514-4a44-8350-6a86d10f33c9 | 9 | public static void mapClasses(int numClusters, int lev, int[][] counts,
int[] clusterTotals, double[] current, double[] best, int error) {
// leaf
if (lev == numClusters) {
if (error < best[numClusters]) {
best[numClusters] = error;
for (int i = 0; i < numClusters; i++) {
best[i] = current[i];
... |
ea98f9d6-5c6b-4a12-8d95-6f4414d00e9a | 2 | public void copyDir(File src, File dest) {
if (src.isDirectory())
for (String file : src.list())
copyDir(new File(src, file), new File(dest, file));
else
ioUtils.copy(src, dest);
} |
b5a10fc4-c0cb-4b7c-a2fa-07d4a5694078 | 8 | public int getValue() {
if (isExpanded()) {
if (!andOrTerm2.isExpanded())
return equalityTerm.getValue();
if (andOrTerm2.getOp().equals("and")) {
if (equalityTerm.getValue() != 0 && andOrTerm2.getValue() != 0)
return 1;
else
return 0;
}
else if (an... |
a921a62a-2542-495b-abb5-2cd6be38e756 | 8 | private boolean r_instrum() {
int among_var;
// (, line 76
// [, line 77
ket = cursor;
// substring, line 77
among_var = find_among_b(a_3, 2);
if (among_var == 0)
{
... |
587e7927-30ea-464a-98f6-ce179f4b12d9 | 9 | private void moreAuthor(){
boolean quit;
String callNumber, name;
LibrarianModel libModel = new LibrarianModel();
Class c = libModel.getClass();
quit = false;
try
{
while(!quit)
{
System.out.println("Enter CallNumber: \n");
callNumber = in.readLine();
if(callNumber.equa... |
25538f1d-5220-43c3-a2c2-ee758e1f7a1f | 5 | protected void updateContPicture(String path) {
// don't update if its already correct!
if (imgPath == path) {
return;
}
try {
Image img = ImageIO.read(new File(path));
if (img == null)
throw new IOException();
// TODO: Make this scale more approriately using Image's
// resolution/aspect ra... |
a965234c-316e-4dbc-b9bd-ae51b50f86cd | 0 | public byte getStatus() {
return status;
} |
508fd479-a4ac-4c1d-84f7-f670e9e76d8d | 2 | public static Vector<Object> selectSortVector(double[] aa){
ArrayList<Object> list = Fmath.selectSortArrayList(aa);
Vector<Object> ret = null;
if(list!=null){
int n = list.size();
ret = new Vector<Object>(n);
for(int i=0; i<n; i++)ret.a... |
7f385b52-6c78-4a81-b968-53394445da12 | 5 | @Override
public boolean equals(Object object) {
// TODO: Warning - this method won't work in the case the id fields are not set
if (!(object instanceof Attribute)) {
return false;
}
Attribute other = (Attribute) object;
if ((this.id == null && other.id != null) |... |
17ae095c-0adc-49e4-85b3-7e58c79f29ed | 8 | public Expr evaluate(IEvaluationContext context, Expr[] args)
throws ExprException {
assertArgCount(args, 3);
Expr eF = evalArg(context, args[0]);
if (!(eF instanceof ExprNumber))
return ExprError.VALUE;
Expr eY = evalArg(context, args[1]);
if (!(eY insta... |
ad1fccfc-a4b4-4cff-b747-d030df4c82e2 | 9 | public boolean decrypt(){
String decryptedKey="";
boolean found = false;
for (int i=0;i<numberOfEncryptedKeys;i++){
NumberFormat form = new DecimalFormat("000");
AccessController accesscontroller = new AccessController(abeEncryptedKeyPath+"/"+abeEncryptedKeyName+form.format(i)+".cpabe",userKeyPath+"/"+us... |
94e056c3-9657-46de-a6a3-fc5e976a09cd | 6 | @Override
protected final void onButtonClick(Button button) {
if (button.active) {
if (button.id == 1) {
CloudLevelInputScreen screen = new CloudLevelInputScreen(parent, ""
+ minecraft.level.cloudLevel, height, "Enter new value for cloud level...");
... |
348c0152-9268-432e-ad33-ae4af495f527 | 5 | public Model method578(int arg0, int arg1, int arg2, int arg3, int arg4, int arg5, int arg6) {
Model model = method581(arg0, arg6, arg1);
if (model == null) {
return null;
}
if (flatTerrain || flatShading) {
model = new Model(flatTerrain, flatShading, model);
... |
11559738-32a1-4efc-824a-5d3baae765d0 | 1 | protected boolean basicAccept(Handshakedata handshakedata) {
return handshakedata.getFieldValue("Upgrade").equalsIgnoreCase(
"websocket")
&& handshakedata.getFieldValue("Connection")
.toLowerCase(Locale.ENGLISH).contains("upgrade");
} |
654eaf15-e6d2-40da-9d3a-4c04fe9ca2ae | 6 | public boolean attachNext(Linkable paramLinkable)
{
boolean b=false;
Object localObject;
if ((paramLinkable instanceof Instruction))
{
localObject = (Instruction)paramLinkable;
if ((((Instruction)localObject).getPreviousInstruction() == null) && (this.CurrentProgram.getFirstInstruction() =... |
747fd7ed-3d16-4dbb-a124-499ac9a96cd9 | 3 | public void siguienteEjercicio() {
int tiempo = thrTiempo.reiniciarParcial();
lblTiempo.setText("00:00");
if (contador > 0){
eventos.crearHistorial(ejercicios[contador-1], tiempo, nivel);
}
if (contador == ejercicios.length){
setVisible(false);
frr.setVisible(true);
}
if (contador < ejercicios.le... |
c5c01402-14b2-4c7f-a88c-7dc798ca7918 | 4 | private void start() {
while (true) {
try {
processUDP();
} catch (IOException e) {
System.err.println("Error 4" + e.getMessage());
break;
} catch (GameException e) {
System.err.println("Error 5" + e.getMessage(... |
f8923613-4e5d-4806-b88a-d9e639010269 | 4 | private final void parseClientPacket(final int pos, final ByteBuffer buf, final int dataSize, final T client)
{
final boolean ret = client.decrypt(buf, dataSize);
if (ret && buf.hasRemaining())
{
// apply limit
final int limit = buf.limit();
buf.limit(pos + dataSize);
final ReceivablePacket<T> cp ... |
4ac1a9de-e815-448f-aa81-b328fbe6959b | 1 | public static void removeTraySelectionChangedListener(
TraySelectionChangedListener listener) {
if (listener != null) StorageUnitDisplayPanel.traySelectionChangedListeners
.remove(listener);
} |
131f1680-7aec-4f7c-8d92-081e421d252c | 1 | public String getGameStateString() {
if (checkGameState() == 1) {
return "gameOn";
} else return "gameOver";
} |
ed505a9a-8135-4875-8d02-59419b110d29 | 0 | public void setFesIdPos(Integer fesIdPos) {
this.fesIdPos = fesIdPos;
} |
21e369f6-729d-415e-ab49-34b25c302931 | 7 | @Override
public boolean accept(File f)
{
if (f.isDirectory()) return true;
String extension = getExtension(f);
return extension != null && (extension.equals(tiff) || extension.equals(tif) || extension.equals(gif) || extension.equals(jpeg) || extension.equals(jpg) || extension.equals(pn... |
ef566193-88ac-4472-ba50-94f455cac4d3 | 7 | public static List<Region> getClosestOwnedNeighborsToBorder(BotState state, Region inRegion) {
int minDistance = inRegion.getDistanceToBorder();
for (Region neighbor : inRegion.getOwnedNeighbors(state)) {
if (neighbor.getDistanceToBorder() < minDistance) {
minDistance = neighbor.getDistanceToBorder();
}
... |
955ddb72-6a0f-4858-b409-3d83db74cdd0 | 0 | public InSubpackage( String targetPackageName )
{
this.targetPackageName = targetPackageName;
} |
aa61b57f-bfcf-4b76-bdba-eed7c405d426 | 8 | private boolean loadInformation() {
Document doc = null;
try {
doc = Jsoup.connect(url).get();
} catch (IOException e) {
e.printStackTrace();
return false;
}
// If a title has not been set, retrieving the title of the item.
if (this.title == null) {
Elements title = doc
.select("td.bibInfo... |
625f9b2d-3ca5-4972-9acc-06bc7b3ee710 | 8 | @Override
public String translate(String language, String word)
{
final StringBuffer sbw=new StringBuffer(word);
Vector<Integer> V=getSChoices(sbw);
if(V.size()>0)
sbw.insert(V.elementAt(CMLib.dice().roll(1,V.size(),-1)).intValue()+1,'h');
if(CMLib.dice().rollPercentage()<50)
return fixCase(word,sbw.toS... |
f2c575dd-4f91-4e91-b7b1-5b7a787e48e6 | 4 | @Override
protected void paintComponent(Graphics g) {
super.paintComponent(g);
if (rotation % 2 == 1) {
g.drawOval(75, 75, 50, 50);
g.drawLine(0, 100, 75, 100);
g.drawLine(125, 100, 200, 100);
g.drawLine(83, 83, 117, 117);
g.drawLine(83, 11... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.