method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
3634598d-c458-48af-b24c-8ee50d1abaa7 | 1 | private void setBalance(BigInteger balance) throws IllegalArgumentException {
if (! this.canHaveAsBalance(balance))
throw new IllegalArgumentException();
this.balance = balance;
} |
e16e9c8f-e913-4598-a697-9ff42a28a369 | 1 | public void addVariableToLambdaSet(String variable, Set lambdaSet) {
if (!lambdaSet.contains(variable))
lambdaSet.add(variable);
} |
7f190a8b-3296-4172-869f-166363730fc0 | 4 | public void computePaths(Node source) {
this.source = source;
PriorityQueue<Pair> nodeQueue = new PriorityQueue<Pair>();
nodeQueue.add(new Pair(0,source));
// System.out.println(source);
for(int i = 0; i < distance.length; i++)
{
distance[i] = INFINITY;
pred[i] = -1;
}
distance[source.getId()] = 0;... |
f40eb8cc-6af1-4b76-a549-060c536781ca | 3 | private ByteBuffer convertImageData(BufferedImage bufferedImage, Texture tex) {
ByteBuffer imageBuffer = null;
WritableRaster raster;
BufferedImage texImage;
int texWidth = 2;
int texHeight = 2;
// find the closest power of 2 for the width and height
... |
507422d8-35ad-4bd8-8c69-94083dea6aa1 | 5 | public static void init()
{
try
{
Field[] ff = Images.class.getFields();
for(Field f : ff)
{
if(f.getType().isAssignableFrom(ImageIcon.class))
f.set(null, createIcon(f.getName() + ".png"));
}
} catch(Security... |
6fa37535-8138-47dc-8a65-c5daf5026f1a | 2 | public void dumpExpression(TabbedPrintWriter writer)
throws java.io.IOException {
subExpressions[0].dumpExpression(writer, 201);
writer.breakOp();
writer.print(" ? ");
int subPriority = 0;
if (!subExpressions[1].getType().getHint()
.isOfType(subExpressions[2].getType())) {
writer.startOp(writer.IMPL... |
0c6c2a67-a8a1-401f-b037-c040813c4019 | 0 | void setFTS(File f){
this.fTS = f;
} |
f2ae84e6-5720-4079-b00d-1a2efccc80f4 | 0 | @Override
public void draw() {
System.out.println(" # ");
System.out.println(" ### ");
System.out.println(" ##### ");
System.out.println("#######");
} |
a26da6ca-a500-4389-a9b4-7fc8a0fa210d | 4 | @Override
public void mouseClicked(MouseEvent e) {
if(e.getSource() == dataList)
{
try {
int index = dataList.locationToIndex(e.getPoint());
Dwarf dwarf = dwarfList.get(index);
showDwarfData(dwarf);
} catch (BadLocationException... |
826ac036-642d-4532-aef6-5a9d68b5fe64 | 3 | public void setPlateWidth(double width){
if(width<=0.0D)throw new IllegalArgumentException("The plate width, " + width + ", must be greater than zero");
this.plateWidth = width;
if(this.plateSeparation!=-1.0)this.distancesSet = true;
if(this.distancesSet)this.calculateDistributedCapacita... |
df485160-bfd5-4d35-84c3-4925b6eace43 | 6 | public static String findUser(Map<String, Object> paramMap) throws SQLException{
String userName = paramMap.get("userName")==null ? "" : (String)paramMap.get("userName");
String password = paramMap.get("password")==null ? "" : (String)paramMap.get("password");
BEGIN();
SELECT(User.COLUMNS);
... |
684be971-2b6e-41b0-bfea-0ddcc0e34544 | 3 | @Override
public void run() {
ResultSet paperIDSet=getPaperIDSet();
String insert="insert into paperauthorList(paperid,authorlist) values(?,?);";
PreparedStatement statement=null;
int count=0;
try {
SQLconnection connection=new connection().conn();
statement=connection.conn.prepareStatement(insert);
... |
e957fdf7-d5a4-4f21-94fa-f36a78d4d54a | 5 | public int storeTicket(Ticket tick) {
int result = 0;
ResultSet rs = null;
PreparedStatement statement = null;
try {
statement = conn.prepareStatement("insert into Tickets (WorkerID_FK, Subject, Pending, Active, Closed) values (?,?,?,?,?)", Statement.RETURN_GENERATED_KEYS);
statement.setInt(1, tick... |
f54d9ef8-793a-42af-b9c0-1881b20c2753 | 6 | public void initializeMigration(Random random) {
Specification spec = getGame().getSpecification();
ServerPlayer player = (ServerPlayer) getOwner();
List<RandomChoice<UnitType>> recruits
= player.generateRecruitablesList();
if (spec.hasOption("model.option.immigrants")) {
... |
3f6c3773-6473-444f-8bf8-7ed6aff82f85 | 4 | @Override
public String toString() {
String stracc = "Graph: \n";
// Edge: edgeId - VerticeName1(vId1) <=>//=> VerticeName2(vId2)
for (Edge e : edges.values()) {
Vertice source = vertices.get(e.getSrcVId());
Vertice target = vertices.get(e.getDestVId());
Set<String> attrs = e.getAttrE();
String acc... |
802af6a1-0934-4754-a58c-7ed5d361a91d | 9 | @SuppressWarnings("unchecked")
private byte[] writeEntry(QualifiedValue<?> value) {
ByteArrayOutputStream bout = new ByteArrayOutputStream();
CodedOutputStream output = CodedOutputStream.newInstance(bout);
try {
output.writeInt32(FIELD_ENTRY_ORDER, value.getOrderIndex());
... |
32a4749d-97ef-4026-b097-3df506caf0a2 | 1 | @Test
public void logTest(){
Logger log = Logger.getLogger(this.getClass().getName());
assertNotNull(log);
log.setLevel(Level.FINEST);
LogHandler.initLogFileHandler(log, "test");
File file = new File("logs/test+.log.0");
assertTrue(file.exists());
log.warning("test2");
log.info("Test");
log.finest("... |
4998b1a4-8289-4c88-a1b2-0db6193bcd91 | 0 | public void initSerie() {
TableModel dataModel = new AbstractTableModel() {
@Override
public String getColumnName(int col) {
return titre;
}
public int getColumnCount() {
return 1;
}
public int getRowCount() {
return 8;
}
public Object getValueAt(int row, int col) {
return n... |
35aafed1-59e1-43ba-b658-36ccb8ec7315 | 8 | private static ArrayList<Integer> getIndependenetVirtualDiskKeys(VirtualMachine vm) throws Exception {
ArrayList<Integer> diskKeys = new ArrayList<Integer>();
VirtualDevice[] devices = (VirtualDevice[]) vm.getPropertyByPath("config.hardware.device");
for (int i = 0; i < devices.length; i++) {
if (devices[i] ... |
e9e09603-438a-4dfd-bdee-0c4264618fa6 | 7 | private void assignCornerElevations() {
LinkedList<Corner> queue = new LinkedList();
for (Corner c : corners) {
c.water = isWater(c.loc);
if (c.border) {
c.elevation = 0;
queue.add(c);
} else {
c.elevation = Double.MAX_V... |
7af090f1-2c3f-4a57-bbdf-91c43386f119 | 8 | private int getLargestProduct(int numOfAdjacent) {
int max = 0;
for (int i = numOfAdjacent - 1; i < GRID.length - numOfAdjacent + 1; i++) {
for (int j = numOfAdjacent - 1; j < GRID[i].length - numOfAdjacent + 1; j++) {
int productUp = 1;
int cursor = numOfAdjacent - 1;
while (cursor >= 0) {
prod... |
c0238194-0529-4b5d-acf5-80976cbdde95 | 8 | public void setPointDimensions(int count, int numBytes) {
if (count <= 0) {
throw new IllegalArgumentException("point dimension count must be >= 0; got " + count + " for field=\"" + name + "\"");
}
if (count > PointValues.MAX_DIMENSIONS) {
throw new IllegalArgumentException("point dimension coun... |
70dbd862-8c69-4ebb-b2c3-278019a3dba0 | 0 | public IntegerResource(int value) {
this.value = value;
} |
bfbac35a-e42f-4fb6-b324-914d462ccfe8 | 6 | public String getStr(char c1,char c2){
String tmp_str ="";
if(c2 == ' '){
tmp_str = "1"+c2;
}else{
if(c1==c2 && c1=='1'){
tmp_str = "21";
}else if(c1==c2 && c1=='2'){
tmp_str = "22";
}else if(c1!=c2 ){
tmp_str = "1"+c1+"1"+c2;
}
}
return tmp_str;
} |
6618c3d2-193c-476c-8a11-b666ba94fd25 | 8 | @Override
public Ant run() {
Ant bestSoFar = null;
final int limit = maxIter / 2;
int stagnationCounter = 0;
int div = maxIter / 50;
final int stagnationLimit = div < 10 ? 10 : div;
for (int i = 0; i < maxIter; i++) {
List<Ant> ants = new ArrayList<>(l);
for (int j = 0; j < l; j++) {
Ant ant = ne... |
dcc4cf94-d706-40a3-ad8c-db9034255305 | 4 | public static String getSignature(String secret, String... values) {
if (isBlank(secret)) {
throw new IllegalArgumentException("The value of 'secret' can't be blank.");
}
if (values == null || values.length < 1) {
throw new IllegalArgumentException("The 'values' can't be ... |
94b9c323-20eb-4192-959d-a1cff8499300 | 2 | protected static String containedText(Node node) {
NodeList children = node.getChildNodes();
for (int i = 0; i < children.getLength(); i++) {
Node c = children.item(i);
if (c.getNodeType() != Node.TEXT_NODE)
continue;
return ((Text) c).getData();
}
return null;
} |
066d3494-0e3d-4c5b-bf4d-40ab5fd4179d | 3 | public void waitTillDone() {
while (true) {
Thread t = threadVar.get();
if (t == null) {
return;
}
try {
t.join();
} catch (InterruptedException e) {
Thread.currentThread().interrupt(); // propagate
return;
}
}
} |
91a0b700-0c3f-498f-937a-c9691ca1742d | 2 | void hideMe() {
for (int i=100; i>0; i--) {
label.setForeground(new Color(1, 1, 1, (float)i / 100f));
label.setBackground(new Color(0, 0, 0, (float)i / 100f));
label.setBorder(BorderFactory.createLineBorder(new Color(0, 0, 0, (float)i / 100f), 5, false));
try {
Thread.sleep(5);
} catch (Interrupted... |
59f5be66-c00d-4f72-90bd-78edbf702277 | 0 | @XmlElementWrapper(name = "data")
@XmlElement(name = "EmailKontakt")
public ArrayList<EmailKontakt> getContactList() {
return contactList;
} |
2addc93d-07a3-4b03-a4a4-0bd5d3bf668e | 7 | protected BeanAutoDetect(Class<?> clazz) throws DaoGenerateException {
this.clazz = clazz;
Map<String, PropertyDescriptor> descriptors;
try {
descriptors = IntrospectorUtils.getPropertyDescriptors(clazz);
} catch (Exception e) {
throw new DaoGenerateException("解析类[" + clazz + "]失败:", e);
}
for (Entr... |
82ca4fd4-2256-4eae-bdf3-8a94a7471bf9 | 8 | public static String checkStatus(String dirName)
{
GetAbsolutePath pt = new GetAbsolutePath();
String absolutePath = pt.getPath();
File directory = new File(absolutePath + dirName);
File outFile = new File(absolutePath + dirName + "/outfile");
File outTree = new File... |
5d727db4-638b-46c5-b634-595cbe77d24e | 0 | public void setContentType(String contentType) {
this.contentType = contentType;
} |
d103ab73-1c3f-4c96-ab81-ec0172839172 | 1 | public Coord3d[] returnCommonCoordinates() {
Coord3d[] temp = new Coord3d[commonCoordinates.size()];
for (int i = 0; i < commonCoordinates.size(); i++) {
temp[i] = commonCoordinates.get(i);
}
return temp;
} |
6821ceda-fad8-4153-bd6c-c55a05fe2bf0 | 2 | public static void main(String[] args) {
List<Product> list = new ArrayList<Product>();
Product pro = null;
for(int i=0;i<2;i++){
pro = new Product();
pro.setSku("1"+i);
pro.setName("峻德"+i);
pro.setDescription("1"+i);
pro.setOnline("1"+i);
list.add(pro);
}
ComparatorProduct compare ... |
6378d3b1-0d26-4a2d-8665-20cc2183792e | 7 | public static boolean unequipItem(Hero owner, Item item) {
if (owner != null && item != null && isItemEquipped(owner, item)) {
// item is equipped -> remove it
// set owner to null for item abilities
// so that a unit cannot use them anymore
owner.getEquipment().remove(item);
Set<Ability> abilities = i... |
b2166e1e-eb1b-4536-8917-cbf4a263111a | 6 | static public BufferedImage[] loadImages(File f) throws IOException {
InputStream istream = new FileInputStream(f);
BufferedInputStream buffin = new BufferedInputStream(istream);
BinaryInputStream in = new BinaryInputStream(buffin);
try {
in.mark(32000);
IconDir... |
24565a6f-47ed-40ac-ad60-220be9dd532d | 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 fe... |
5e87656f-50e9-49a9-9d03-fe6863fc1c96 | 3 | public static int[] analyzeHistogram(ImageData imageData) {
int height = imageData.height;
int width = imageData.width;
int depth = imageData.depth;
int[] histogram = new int[256];
int c = 0;
for (int i = 0; i < height; i++) {// height
for (int j = 0; j < width; j++) {// width
// byte gray = imageDat... |
737f8850-44d7-4f42-8c63-450fb111fa83 | 1 | @Override
public String[] getPresentStatusLog() {
ArrayList<String> statusLog = new ArrayList<String>();
for (int i = 0; i < defaultStatusList.size(); i++) {
statusLog.add(defaultStatusList.getElementAt(i));
}
return statusLog.toArray(new String[statusLog.size()]);
} |
e1bbdf20-4e80-4bad-9739-c3a99327cb32 | 4 | public void run(String[] args) throws Exception {
if (args.length == 1) {
int selectedIndex = 1;
String proto = null;
try {
PCSCManager.connect(selectedIndex, proto);
} catch (Exception e) {
selectedIndex = -1;
}
if (selectedIndex == -1 || proto == null)
Logger.log("Uso: " + getTe... |
5cab3384-2b3a-4130-b8fa-750c9ce6277b | 0 | public void setFechaRecogida(String fechaRecogida) {
this.fechaRecogida = fechaRecogida;
} |
9849e9d8-cc6d-4c0e-b62c-72a7c158b274 | 7 | private MidiDevice openMidiDevice( String containsString )
{
message( "Searching for MIDI device with name containing '" +
containsString + "'" );
MidiDevice device = null;
MidiDevice.Info[] midiDevices = MidiSystem.getMidiDeviceInfo();
for( int i = 0; i < midiDevice... |
5540801f-fb3b-4342-a494-0399b61af78e | 4 | public boolean mousedown(Coord c, int button) {
if(a || button != 1 || c.y < 16 || c.y > sz.y - 10)
return(false);
check(this);
return(true);
} |
21ef9a6c-a646-44ec-bb87-a3eb67139342 | 8 | public static Function getFunction(Library l, Object o) {
Dictionary d = null;
if (o instanceof Reference) {
o = l.getObject((Reference) o);
}
// create a dictionary out of the object if possible
if (o instanceof Dictionary) {
d = (Dictionary) o;
... |
37e3d7ab-9ee6-42c3-acd5-aa2d8affd0f1 | 4 | private Method findFromStringMethod(Class<?> cls, String methodName) {
Method m;
try {
m = cls.getMethod(methodName, String.class);
} catch (NoSuchMethodException ex) {
try {
m = cls.getMethod(methodName, CharSequence.class);
} catch (NoSuchMet... |
549271b0-74da-4cae-a716-21d165aadaab | 6 | private void checkAlive() {
ArrayList<ComponentEntry> removeList = new ArrayList<ComponentEntry>();
long now = System.currentTimeMillis();
for (ComponentEntry ap : this.accessPoints.values()) {
if (ap.timestamp+timeout < now) {
removeList.add(ap);
}
}
for (ComponentEntry ap : removeList) {
disass... |
6b897b4c-bf39-4c0b-b147-0469113c63d4 | 5 | public WordSearch(String filename, String name) {
this.name = name;
try {
scanner = new Scanner(new File(filename));
} catch (FileNotFoundException e) {
e.printStackTrace();
}
this.n = scanner.nextInt();
this.m = scanner.nextInt();
puzzle = new String[n];
for (int i = 0; i < n; i++) {
puzzle[i... |
242441b4-050d-48ae-a810-e701042d8894 | 0 | public boolean getTeam()
{
return this.team;
} |
b43199a9-bfd5-4ac0-8acc-477bdf1d04e6 | 6 | public MethodAnalyzer(ClassAnalyzer cla, MethodInfo minfo,
ImportHandler imports) {
this.classAnalyzer = cla;
this.imports = imports;
this.minfo = minfo;
this.methodName = minfo.getName();
this.methodType = Type.tMethod(minfo.getType());
this.isConstructor = methodName.equals("<init>")
|| methodName.... |
5bcc24f5-d035-420e-a09d-6164bbd49931 | 5 | public static void injectValueInStaticField(Class<?> clazz, String fieldName, Object value)
throws JStrykerException, IllegalArgumentException {
if (clazz == null) {
throw new IllegalArgumentException("Clazz cannot be null.");
}
if (fieldName == null) {
throw new IllegalArgumentException("Field name can... |
bf9fca0f-3895-4a09-b32f-95c98d071f08 | 1 | public void showHideNavigator() {
if (!toolbar.getTreeSelected())
center.remove(navigator);
else
center.add(BorderLayout.WEST, navigator);
center.revalidate();
center.repaint();
} |
97a175af-1f04-4e80-ada7-8525f49d1cf8 | 7 | public static ArrayList<Object> getObjects(List<?> rows,
Class<?> decoratorClass) {
ArrayList<Object> resultList = new ArrayList<Object>();
Object firstRow = rows.get(0);
Class<? extends Object> rowClass = firstRow.getClass();
Integer lp = 1;
for (Object row : rows) {
try {
Constructor<?> construc... |
a72759ad-dd44-4926-bc6e-4235a0a09579 | 6 | public boolean isBlackJack()
{
boolean hasAce = false;
boolean hasTen = false;
for ( int i = 0; i < hand.size(); i++ )
{
if ( hand.get(i).getFace() == Rank.ACE )
{
hasAce = true;
break;
}
}
for ( int i = 0; i < hand.size(); i++ )
{
if ( hand.get(i).getValues().get(0) == 10 )
... |
0192cf22-8ece-44e0-80ca-49d002c02255 | 9 | private final void draw0(byte[] is, int[] is_25_, int i, int i_26_,
int i_27_, int i_28_, int i_29_, int i_30_,
int i_31_, int i_32_, int i_33_, int i_34_,
aa var_aa, int i_35_, int i_36_) {
aa_Sub3 var_aa_Sub3 = (aa_Sub3) var_aa;
int[] is_37_ = ((aa_Sub3) var_aa_Sub3).anIntArray5201;
int[] is_38_ ... |
b40a4bf1-2e8d-4534-a7d2-82f4f8531b7c | 0 | public void mousePressed(MouseEvent e)
{
// TODO Auto-generated method stub
} |
b6358854-89b7-4485-8f95-b9fc88686418 | 8 | private TextAnchor textAlignPtForLabelAnchorV(RectangleAnchor anchor) {
TextAnchor result = TextAnchor.CENTER;
if (anchor.equals(RectangleAnchor.TOP_LEFT)) {
result = TextAnchor.TOP_RIGHT;
}
else if (anchor.equals(RectangleAnchor.TOP)) {
result = TextAnchor.TOP_CE... |
458c260a-88dd-4696-ac78-4f86095828bf | 4 | @Override
public void run() {
for (Player player : World.getWorld().getPlayers()) {
try {
if (player.getSession().getSocketChannel().isOpen()) {
for (Packet packet = player.getPacketQueue().poll(); packet != null; packet = player.getPacketQueue().poll()) {
PacketManager.handlePacket(player, packet)... |
15fea06c-2363-4f7c-8ae5-e292a0e2de17 | 0 | @Override
public void setGUITreeComponentID(String id) {this.id = id;} |
cf0ae0d8-811e-4902-8916-c35fe4066f6b | 6 | public static void ledprocess(String filepath, String result, String sn){
String finalresult = "";
int errorcode=0;// print error code in the final output file;
int errornum = 7;
File outputfile = new File(filepath);
if ((result.equals("P"))||(result.equals("p"))||(result.equals("pass"))||(result.equals("... |
cee505d5-9e74-4d1b-9f53-8450f452d115 | 9 | @Override
public Object getValueAt(int row, int col) {
String colName = getColumnName(col);
switch (colName) {
case "Select":
return selectList.get(row);
case "Status":
return entries.get(row).getStatus().toString()... |
2ea31359-0e3f-41e0-adfb-cc490524d17d | 5 | public void drawObjects(BufferedImage canvas, boolean fill)
{
BufferedImage image = new BufferedImage(_width, _height, BufferedImage.TYPE_INT_RGB);
Graphics2D g = image.createGraphics();
g.drawImage(VisionUtils.convert2grey(canvas), 0, 0, null);
// draw groun... |
de1375f2-79d7-4548-be7f-9bb52e4ad833 | 5 | public void actionPerformed(ActionEvent e) {
while (true) {
String name = JOptionPane.showInputDialog("Enter name");
String number = JOptionPane.showInputDialog("Enter number");
if (name == null || number == null) {
gui.messageArea.setText("Canceled");
break;
} else if (name.equals("") || number.e... |
9aeca423-a767-43b4-adfb-cccf1ec38ef9 | 3 | public static void main(String[] args) {
// TODO Auto-generated method stub
int[][] res = generateMatrix(0);
for (int i = 0; i < res.length; i++) {
for (int j = 0; j < res[i].length; j++) {
System.out.print(res[i][j] + " ");
}
System.out.println();
}
int[][] matrix = {{1},{2},{3},{4},{5},{6}};... |
3b14aa66-e9af-45ad-8797-c6ee438e473f | 8 | public String toString(){
StringBuffer sb = new StringBuffer();
switch(type){
case TYPE_VALUE:
sb.append("VALUE(").append(value).append(")");
break;
case TYPE_LEFT_BRACE:
sb.append("LEFT BRACE({)");
break;
case TYPE_RIGHT_BRACE:
sb.append("RIGHT BRACE(})");
break;
case TYPE_LEFT_SQUARE:
... |
8b0f4091-5557-412c-b438-07fc8e06c380 | 7 | static void sendPBNotification(final Context context, String displayScore) {
if((flags & FLAG_NO_NOTIFICATION) > 0) return;
final String appName = Utils.getAppLabel(context);
if (appName == null) {
return;
}
if (Utils.packageIsInstalled(HEYZAP_PACKAGE, context) || !Utils.marketInstalled(context) || !Utils... |
d904c549-6f6d-472b-8294-88672da5f716 | 9 | @Override
protected void processElement(final XMLStreamReader reader, final Mop item)
throws XMLStreamException {
switch (reader.getNamespaceURI()) {
case NAMESPACE:
switch (reader.getLocalName()) {
case "Geometrie":
Utils.p... |
da381544-be87-4446-afe7-6f132d8bba11 | 2 | public void mousePressed(MouseEvent e) {
if (e.getButton() == MouseEvent.BUTTON1)
Main.isMouseLeft = true;
else if (e.getButton() == MouseEvent.BUTTON3)
Main.isMouseRight = true;
} |
083a5dab-c8f2-4442-a199-29d2520d0e9b | 2 | @Override
public int matches( short[] sequenceA, int indexA, short[] sequenceB, int indexB, int count )
{
for (int i = 0; i < count; i++)
{
if (sequenceA[indexA + i] != sequenceB[indexB + i])
{
return i;
}
}
return count;
} |
75c63855-43e8-418a-8051-e8fad4c8c304 | 5 | private void dfs(Graph<?> g, Object v, boolean alt) {
this.marked.put(v, true);
//System.out.println(v);
//System.out.println(this);
for (Object temp : g.getAdjacentVertices(v)) {
if (!marked.get(temp)) {
this.color.put(temp, alt);
dfs(g, temp... |
e00fc14c-ed61-4b21-b992-f9a6cf5eb590 | 5 | public static void main(String[] args) {
// TODO Auto-generated method stub
Scanner in = new Scanner(System.in);
while (in.hasNextInt()) {
int a = in.nextInt();
if ( a == 0 ) break;
for ( int k = 1;;k++) {
// Try m
// Target : J(a,m,a) = 2
// Initial : J(1,m,1) = 0
int s = 0;
for ( in... |
bce2b295-9859-4ab3-a0ff-93938202e3fc | 4 | protected void pageChange(int newPageIndex) {
switch (newPageIndex) {
case indexSRC:
if (isDirty())
updateTextEditorFromTable();
break;
case indexTBL:
if (isDirty())
updateTableFromTextEditor();
break;
}
isPageModified = false;
super.pageChange(newPageIndex);
} |
ea104fa7-1c69-4be3-a20e-02d1db2e6e86 | 4 | public void gaussianProbabilityPlot(){
this.lastMethod = 0;
// Check for suffient data points
this.gaussianNumberOfParameters = 2;
if(this.numberOfDataPoints<3)throw new IllegalArgumentException("There must be at least three data points - preferably considerably more");
... |
c2fd6d8c-7530-4377-9ae7-7cdea2a212ec | 4 | @Override
public void valueChanged(ListSelectionEvent e) {
JList lsm = (JList) e.getSource();
if (lsm == ticketList) {
int selectedIndex = lsm.getSelectedIndex();
if (selectedIndex >= 0) {
currentTicket = selectedIndex;
... |
746e551c-077d-4bf9-8613-74bbd2a91c4a | 6 | public Topology2D(Base basis, int coarseness, Space space){
this.basis = basis;
this.coarseness = Math.abs(coarseness);
switch(space.getTau()){
case "Cylinder":
this.space = Topology2D.Cylinder.class;
break;
case "Torus":
this.space = Topology2D.Torus.class;
break;
case "Moebius":
this.... |
237f5acd-ca63-4984-8a22-5c95670fa70d | 0 | public void setProblemList(ProblemList problemList) {
this.problemList = problemList;
} |
e849426f-d14b-4a8f-8bbb-0529e9af7ad4 | 3 | @Override
public boolean equals(Object obj) {
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
final Email other = (Email) obj;
if (!Objects.equals(this.endereco, other.endereco)) {
return false... |
c2215181-162d-481f-97ef-46118d7a9534 | 0 | public UpgradeManager() {
this.allUpgrades = new Upgrade[]{
new Upgrade(UpgradeType.Body, "Bodyup 1", null),
new Upgrade(UpgradeType.Head, "Headup 1", null),
new Upgrade(UpgradeType.Body, "Bodyup 2", null)
};
this.allHeads = new Head[]{
new Head(1, "Head 1"),
new Head(1, "Head 2")
};
this.a... |
1e7032fa-daae-4d37-9e71-6d25c2848831 | 3 | public AST Q()
{
// Q -> R | R Q
AST r = R();
String next = toks.peek();
if(isAlphabetic(next) || "(".equals(next) || isNumber(next))
return new Product(r, Q());
else
return r; // I don't think I should *always* do this
// (e.g., if I peek and the R is fo... |
0589df42-ff54-4f9c-a274-b005527cc5a5 | 6 | public boolean equals(Object other)
{
if(other == null || !(other instanceof Observation))
return false;
Observation o = (Observation) other;
if(this.itype != o.itype) return false;
if(this.obsID != o.obsID) return false;
if(!this.position.equals(o.position)) ret... |
c36bb677-70d7-4a7d-85ad-1ee86fb1ecf3 | 3 | public SettingsView() {
GridBagLayout gridBagLayout = new GridBagLayout();
gridBagLayout.columnWidths = new int[] { 0, 0 };
gridBagLayout.rowHeights = new int[] { 0, 235, 0, 0 };
gridBagLayout.columnWeights = new double[] { 1.0, Double.MIN_VALUE };
gridBagLayout.rowWeights = new double[] { 0.0, 1.0, 0.0,
... |
09a4d35d-0f26-4d8b-bbf4-2a07584fd831 | 4 | public boolean OnkoYhteys(Suunta suunta){
switch(suunta){
case Pohjoinen:
return OnkoYhteysPohjoiseen();
case Ita:
return OnkoYhteysitaan();
case Etela:
return OnkoYhteysEtelaan();
case Lansi:
return ... |
038de73c-3b89-403e-ad77-12c24cb5f6e9 | 2 | private final Node<K> buildTree(final Hashtable<K,Integer> distribution) {
final TreeSet<Node<K>> forest = new TreeSet<Node<K>>();
for (K key : distribution.keySet()) {
forest.add(new Node<K>(key,distribution.get(key)));
}
while (forest.size()>1) {
Node<K> tree0 = forest.first();
forest.remove(tree0);
... |
933609a8-b808-43fc-ae16-3b72e4c1ac19 | 4 | public static int numDistinct(String S, String T) {
int[][] f = new int[S.length() + 1][T.length() + 1];
for (int k = 0; k < S.length(); k++)
f[k][0] = 1;
for (int i = 1; i <= S.length(); i++) {
for (int j = 1; j <= T.length(); j++) {
if (S.charAt(i - 1) == T.charAt(j - 1)) {
... |
f5f3556c-9166-4a93-911b-0f87627275f7 | 5 | public boolean isColliding(GameObject obj){
//If the left side of this is to the left right side of obj and the right side of this is to the right of the left side of obj
if(position.getComponent(0) < obj.position.getComponent(0) + obj.width && this.position.getComponent(0) + this.width > obj.position.getComponen... |
61bb5660-2a86-481a-ab53-e4f58e541b0f | 3 | public void dispatch() {
List<StoreLoader<?>> loaders = popLoaders();
for (StoreLoader<?> loader : loaders) {
loader.memoryDispatch(rows);
}
} |
079869ad-abfd-4607-9b80-e255e83c8d99 | 7 | protected void handleControlPropertyChanged(final String PROPERTY) {
if ("RESIZE".equals(PROPERTY)) {
resize();
} else if ("COLOR".equals(PROPERTY)) {
led.setStyle("-led-color: " + Util.colorToCss((Color) getSkinnable().getLedColor()) + ";");
changeStyle();
} ... |
345f6a7b-77e2-4b9d-983a-e637f6e924a4 | 6 | @Override
public final void render(Graphics g)
{
if (hub.DEBUG)
{
g.setColor(Color.DARK_GRAY);
g.drawRect((int) Math.round(x), (int) Math.round(y), (int) Math.round(width), (int) Math.round(height));
}
Graphics2D g2d = (Graphics2D) image.get().getGraphics();
g2d.setComposite(Alp... |
999058d6-0c3f-457c-9d7d-8496fafab1cb | 7 | static List<Vertex> bfs(Graph g, Vertex start) {
if (g == null) {
throw new IllegalArgumentException("Input graph must not be null.");
}
if (start == null) {
throw new IllegalArgumentException("Input vertex must not be null.");
}
final List<Vertex> retu... |
bdcadca5-ea3c-41d2-a5b4-bdd3c06a3a4e | 6 | private Map<?, ?> createObjectContainer(ContainerFactory containerFactory){
if(containerFactory == null)
return new JSONObject();
Map<?, ?> m = containerFactory.createObjectContainer();
if(m == null)
return new JSONObject();
return m;
} |
08134e53-299a-486e-a793-5d7890b19dc9 | 8 | public void checkGame() {
if (gameDAO == null) {
}
else if (!gameDAO.getIsRunning()) {
}
else if ((playerDAO.getAllWerewolves().size() == 0)
|| (playerDAO.getAllWerewolves().size() > playerDAO
.getAllTownspeople().size())) {
gameDAO.endGame();
List<Player> aliveList = playerDAO.getAllAlive()... |
a1f29bf8-a025-424f-b0e2-d6a32e404ae7 | 1 | @Override
public void componentShown(ComponentEvent e) {
if (resizeOnShow) {
e.getComponent().setSize(initialWidth, initialHeight);
}
} |
2151bdfc-e30f-4740-ac42-d66a42afed06 | 0 | public YAML(Iterable<String> headers) {
this.headers = headers;
} |
6202314d-8af3-40a4-a0cf-0dda04969d88 | 9 | public void startServer() throws IOException {
// Create a UUID for SPP
uuid = new UUID("1101", true);
// print uuid
logString.append("UUID : " + uuid.toString());
logString.append("\n");
// Create the service url
connectionString = "btspp://localhost:" + uuid +... |
bf5b8d76-075b-4c47-bcb8-3d480a457b57 | 0 | public OutlineCommentIndicator(OutlinerCellRendererImpl renderer) {
super(renderer, GUITreeLoader.reg.getText("tooltip_toggle_comment"));
} |
99d2217f-ed62-4cc0-9cc9-902ebfbbbf14 | 0 | public long getId() {
return Id;
} |
5ab7632f-3971-40a2-a8d0-29ba0315f351 | 0 | @Test(expected = RuntimeException.class)
public void twoInchesIsBetterEightOuncesShouldThrowException(){
ArithmeticQuantity two_in = new ArithmeticQuantity(2, Distance.INCHES);
ArithmeticQuantity eight_oz = new ArithmeticQuantity(8, Volume.OUNCE);
two_in.isBetter(eight_oz);
} |
bdc909d2-a4ef-4229-9b21-e36d37b300d5 | 1 | public void visit_d2l(final Instruction inst) {
stackHeight -= 2;
if (stackHeight < minStackHeight) {
minStackHeight = stackHeight;
}
stackHeight += 2;
} |
07b834b7-140c-4f33-a780-6c7b711e77b3 | 8 | protected void cacheReturn(String cacheKey, InterceptorChain chain, Method method, Cache cacheAn) throws Throwable {
// 获取缓存类型,根据缓存类型不同分别对缓存有不同的操作方式
CacheType cacheType = cacheAn.cacheType();
if (cacheType.equals(CacheType.String)) {
super.cacheReturn(cacheKey, chain, method, cacheAn);
} else if (cacheType.e... |
1e0f7ab2-3ebf-46d4-9a07-58370a01f365 | 4 | public MainFrame() throws HeadlessException {
// initializing main form
super(ZIP_ARCHIVER_V1_0);
setMinimumSize(new Dimension(WIDTH_MAIN_FRAME, HEIGHT_MAIN_FRAME));
setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
setLocationRelativeTo(null);
pack();
//... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.