method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
fc63ed57-a144-46d1-b0c3-e59c3410bc93 | 3 | private static void maybePrintDescriptors (int indent, Descriptor d)
{
while (d != null) {
switch (d.getDescriptorType ()) {
case Descriptor.TYPE_INTERFACE:
case Descriptor.TYPE_ENDPOINT:
return;
default:
indentLine (indent, "<descriptor type='"
+ d.getDescriptorType ()
+ "' le... |
dd7028b2-b094-4910-a63a-5392b5454c6e | 8 | private static TspPopulation[] generate(){
stepResults = new double[MAX_STEPS][GLOBAL_STEPS];
Graph g = new Graph(INDIVIDUAL_SIZE);
TspPopulation[] h = new TspPopulation[GLOBAL_STEPS];
for (int i = 0; i < GLOBAL_STEPS; ++i){
h[i] = new TspPopulation(POPULATION_SIZE, INDIVIDUA... |
0ebd76d9-308c-4dbc-a4fb-8e3080f374b8 | 2 | public void draw(GOut g) {
synchronized (this) {
// Graphics g = graphics();
g.image(a ? dt : ut, new Coord(3, 3), new Coord(sz.x - 6, 13));
g.image(bl, new Coord());
g.image(br, new Coord(sz.x - br.sz().x, 0));
g.image(bt, new Coord(3, 0), new Coord(sz.x - 6, bt.sz().y));
g.image(bb, new Coord(3, s... |
facc4b6c-8602-4730-a077-cb768a0e7e47 | 7 | private String getSymbolicName(int keyCode) {
if (keyCode == KeyEvent.VK_UNDEFINED)
return null;
/*
* else if(keyCode == KeyEvent.VK_OPEN_BRACKET) return "["; else
* if(keyCode == KeyEvent.VK_CLOSE_BRACKET) return "]";
*/
if (keyCode >= KeyEvent.VK_A && keyCode <= KeyEvent.... |
13c4d6ab-1140-40ef-9180-516b54e9c193 | 8 | protected SubCommand(Object commandContainer, Method method, String name, String[] aliases, Permission permission, boolean addPermissionParent, String usage)
{
if (commandContainer == null)
{
throw new IllegalArgumentException("The command container must not be null!");
}
... |
09226dbc-ad07-4298-9cd4-df1925686e06 | 7 | public static String escape(String str) {
int len = str.length();
StringBuffer buf = new StringBuffer(len + 5);
char[] ch = str.toCharArray();
for (int i = 0; i < len; i++) {
switch (ch[i]) {
case '\\' :
buf.append("\\\\");
bre... |
4a61d010-2434-4e6a-93d2-99badcd065f7 | 0 | public static void main(String[] args) {
// float f = 1.0; <-- Error
float x = (float) 1.0;
float y = 1.0F;
} |
e4589c06-8a3c-490e-ac6c-70464ce8d0bf | 8 | protected void preTraverse(Node node)
{
if (node == null)
{
return;
}
if (node.type == Node.START_TAG || node.type == Node.START_END_TAG)
{
if (currIndex <= maxIndex && (tagName.equals("*") || tagName.equals(node.element)))
{
... |
00ab9800-122a-4d9f-a4d9-a20c6b9a031f | 0 | public XMLCheckerFileContentsHandler(String checkType, String lineEnding) {
super(lineEnding);
init();
setCheckType(checkType);
} |
7d07e866-74d4-4ffe-b0ca-f083511ebace | 5 | public static void main(String[] args) throws ClassNotFoundException {
// TODO code application logic here
Connection conn = null;
Statement stat = null;
ResultSet rs = null;
try {
Class.forName("org.h2.Driver");
conn = DriverManager.getConnection("jdbc:h2... |
0da03758-3b94-4682-ae16-d1b96f1cb720 | 2 | @Override
public List<DemandeMoyen> getDemandesMoyen() throws BadResponseException {
List<DemandeMoyen> demandes = new ArrayList<DemandeMoyen>();
JsonRepresentation representation = null;
// R�cup�ration de la liste des demandes
Representation repr = serv.getResource("intervention/" + interId
+ "/demande"... |
2b6d1380-4124-4d1f-82f0-3844ab7ee5a2 | 2 | public void testPropertyCompareToYear() {
LocalDateTime test1 = new LocalDateTime(TEST_TIME1);
LocalDateTime test2 = new LocalDateTime(TEST_TIME2);
assertEquals(true, test1.year().compareTo(test2) < 0);
assertEquals(true, test2.year().compareTo(test1) > 0);
assertEquals(true, tes... |
1d7def26-bfd8-41e7-95bf-2fe6d4cf4bca | 0 | public void setPrice(double price) {
this.price = price;
} |
28351257-e003-476f-8903-0ed2371d0678 | 4 | @Test
public void testExecute() throws Exception {
Extent extent = new Extent(0d, 0d, 201d, 201d);
GraphBuilder<MyLocatableNode, Object> builder = Graphs.createGridIndexedGraphBuilder(extent, 10);
for (int i = 0; i < 5; i++) {
for (int j = 0; j < 5; j++) {
if (we... |
6dd96ae1-7076-473a-8b12-ef00a14016e6 | 9 | @Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
Image other = (Image) obj;
if (pixels == null) {
if (other.pixels != null)
return false;
} else if (!pixels.equals(other.pixels))
ret... |
7576e3ac-0eb4-460c-b737-934ffc3b0ec8 | 4 | @Override
public boolean isSolid(int pX, int pY) {
if( 0<=pX && pX<=mWidth &&
0<=pY && pY<=mHeight)
return true;
return false;
} |
78259b15-4610-4855-bb81-133422145eb4 | 4 | public final void vertex(float var1, float var2, float var3) {
if(this.texture) {
this.data[this.length++] = this.u;
this.data[this.length++] = this.v;
}
if(this.color) {
this.data[this.length++] = this.r;
this.data[this.length++] = this.g;
this.data[this.... |
d6e986ac-aed7-40ac-a19f-aeb836682d65 | 4 | public SipcResponse getFullSipcResponse(){
//有个问题:这里这么多的分块回复,每个回复都是独立的,那究竟最终的回复是依据第一个还是最后一个呢?
//这里依据的是最后一个回复
//新建一个回复对象,把最后一个回复的状态和回复消息复制到到新回复对象
SipcResponse lastResponse = this.sliceResponseList.get(this.sliceResponseList.size()-1);
SipcResponse someResponse = new SipcResponse(lastResponse.getStatus(),las... |
70e97a90-ed54-44ee-818a-8dfe3c56d09c | 8 | public String FixFormatSatuan(String strQty, int bigToSmall, int medToSmall){
String newStrQty = "";
//Jika ada selain angka dan carakter dot ( . ) maka format menjadi 0.0.0
boolean angkaTitikValid=true;
if (! strQty.matches("[0-9,.]*")) {
angkaTitikValid=false;
}
/*
... |
13f570f3-1909-4844-8218-444879ab4cd8 | 7 | public static void runCommandWithPar(String cmd, String par) {
if (cmd.equals("CMD_KICK")) User.kick();
if (cmd.equals("CMD_BAN")) User.ban();
if (cmd.equals("CMD_UNBAN")) User.unban();
if (cmd.equals("CMD_BANGLOB")) User.banglob();
if (cmd.equals("CMD_UNBANGLOB")) User.unbanglob();
if (cmd.equals("CMD_OP")... |
583e010f-49a9-4152-96bb-a773e8f31bfc | 5 | @Override
protected void enter() {
final GameObject armour = ctx.objects.select().select(new Filter<GameObject>() {
@Override
public boolean accept(GameObject gameObject) {
return gameObject.type() == GameObject.Type.INTERACTIVE;
}
}).select(ObjectDefinition.name(ctx, "Suit of armour")).poll();
if ... |
9cf25bfa-ae96-4057-8db4-058cc6480f05 | 7 | public void moveFound()
{
if(found.location()==null)
return;
final Vector<Integer> possibilities=new Vector<Integer>();
for(int d=Directions.NUM_DIRECTIONS()-1;d>=0;d--)
{
if(d!=Directions.UP)
{
final Room room=found.location().getRoomInDir(d);
final Exit exit=found.location().getExitInDir(d)... |
d53848fc-41c2-43ee-bd71-406bbb259948 | 0 | @Test
public void edgeReturnsCorrectVerticesWhenConstructed() {
Vertex v = new Vertex(0);
Vertex u = new Vertex(0);
Edge e = new Edge(v, u);
assertEquals(e.getStart(), v);
assertEquals(e.getEnd(), u);
} |
5b8ddca6-b13e-4c53-97fc-67838336f042 | 9 | @Override
public void keyPressed(KeyEvent key) {
if(key.getKeyCode() == KeyEvent.VK_ENTER){
for(int i = 0; i < steps.length; i++){
if(steps[i] ==true){
steps[i] = false;
paused = false;
currentTut++;
}
}
if(over){
s.currentLevel = 0;
s.gs[0].init();
}
}
if(key.getKeyCod... |
0d5c5a2c-f158-4f06-84fa-07d3b4423a42 | 5 | public Integer getFreeTime() {
int time = 18;
for(FitnessClass c : listFitnessClass)
if((c.getName() == null || c.getTutorName() == null) && c.getTime() < time)
time = c.getTime();
if(time < 18) return time;
return null;
} |
0a817296-6910-489e-9da1-258992183883 | 4 | private void initializeResultsFile()
{
if (trace_flag == false) {
return;
}
// Initialize the results file
FileWriter fwriter = null;
try
{
fwriter = new FileWriter(super.get_name(), true);
} catch (Exception ex)
{
... |
a3cc49db-21e1-4859-b552-9621af9f8eca | 1 | public LinkedList<UsefulnessRating> getOwnUsefulnessRatings() throws SQLException {
LinkedList<String> select = new LinkedList<String>();
select.add("*");
LinkedList<String> from = new LinkedList<String>();
from.add("Usefulness");
LinkedList<Pair<String, String>> whereClauses = n... |
b88587d8-3f59-4c31-b951-4854d9ae9059 | 1 | public void validate(Object value) throws InvalidValueException {
if (!isValid(value)) {
throw new InvalidValueException(message);
}
} |
5c5bf6f5-9cbb-43ed-94b3-5f09f5fb6519 | 2 | Omni(T o, JomniMapper mapper){
if (o instanceof Map){
map = (Map)o;
obj = null;
}else{
map = null;
obj = o;
}
this.mapper = mapper;
classInfo = (o != null)?mapper.getClassInfo(o.getClass()):null;
} |
2b4189ff-46d6-4e65-8507-27e7793d0237 | 2 | public void init(int nplayers, int[] pref) {
preference = pref;
n_players = nplayers;
n_bowls = nplayers*2; // Since there are 2 rounds
playerIndex = this.getIndex();
bowlsSeen[0] = 0;
bowlsSeen[1] = 0;
originalDistribution = new int[NUM_FRUITS];
currentDistribution = new int[NUM_FRUITS];
... |
c25a8ba9-a1bf-46d2-9d37-036b0ed19c56 | 3 | public void loescheAlleVerbindungen()
{
for(int y = 0; y < _arrayZeilenzahl; ++y)
{
for(int x = 0; x < _arraySpaltenzahl; ++x)
{
if(existiertRaumAnPosition(x, y))
{
_raumArray[x][y].loescheVerbindungen();
}
}
}
_raumListe.clear();
} |
b124852c-5303-42b9-8529-c0d995cab3b2 | 1 | public static void main(String[] args) {
Heap h = Heap.make(S);
for (int i=0; i<N; i++) {
int t = h.alloc(1+i);
System.out.println("Allocating object " + i + " at address " + t);
h.store(t, 1, h.a);
h.a = t;
}
System.out.println("Before garbage collection;");
h.dump();
Sy... |
2f25d06c-0935-441c-b41a-2448236f8822 | 1 | @Override
public AState breakTie(AState state1, AState state2)
{
if(state1.getG() < state2.getG())
return state1;
else
return state2;
} |
2f75455e-da90-485c-8c68-53e7b9c36e93 | 1 | private static int decodeSequenceNumber(short sequenceNumber) {
return (int) (sequenceNumber < 0 ? sequenceNumber - 2*Short.MIN_VALUE : sequenceNumber);
} |
d40dbce6-83ad-4ba8-8b18-6fa970b0b948 | 9 | public void excecuteCommand(String channel, String sender, String message) throws Exception {
String title = null;
for(String word : message.split(" ")) {
if(word.startsWith("http")) {
title = null;
try {
title = TitleExtractor.getPageTitle(word).replace("YouTube", Colors.BOLD + "1,16You16,4Tube" ... |
cf17a79d-d1dd-44b6-9963-92c1be83f704 | 3 | public void visitNegExpr(final NegExpr expr) {
if (expr.expr().type().isIntegral()
|| expr.expr().type().equals(ClassHierarchy.POS_SHORT)
|| expr.expr().type().equals(ClassHierarchy.POS_BYTE)) {
start(expr, Type.INTEGER);
} else {
prop(expr, expr.expr());
}
} |
223c4770-18d3-4d39-b175-2896e7a601e4 | 9 | public boolean update(AlumnoVO alumno) {
String query = "UPDATE alumnos SET";
Statement consulta = Conexion.getConexion().hacerConsulta();
if(alumno.getNombre() != null){
query += " nombre = " + alumno.getNombre() + ",";
}
if(alumno.getApellidoPaterno() != null){
query += " apellidoPaterno = " ... |
09841a9f-e18a-4fda-a20a-6fb5dbcf1260 | 5 | @Override
public String toString() {
return (day < 10 ? (new StringBuilder().append(0).append(day)) : day) + "-" +
(month < 10 ? (new StringBuilder().append(0).append(month)) : month) + "-" +
year + " " +
(hour < 10 ? (new StringBuilder().append(0).append(hour)) ... |
e0ad2910-2747-4f3f-ba1d-456a7fb63937 | 1 | public static int[] toIntArray(Integer[] data)
{
int[] result = new int[data.length];
for(int i = 0; i < data.length; i++)
result[i] = data[i].intValue();
return result;
} |
3babff67-3737-4ad0-8714-822f17a99832 | 5 | public static boolean findDir(String dir, Pattern p) {
Matcher e = Pattern.compile("^\\.{1}$").matcher(dir);
if(e.find()) {
File[] files = new File(dir).listFiles();
System.out.println("root dir of files: " + Arrays.asList(files));
for(File f : files) {
... |
d700e5f8-fcc2-4a8b-ab99-471c7264144c | 6 | @Override
public GameState[] allActions(GameState state, Card card, int time) {
GameState[] states = new GameState[1];
states[0] = state;
if(time == Time.DAY)
{
GameState root = new GameState(state);
Color faction = card.getFaction();
int amt = 3;
if(root.getPlayer(faction).getGold() < 3)
{
... |
dba688f3-c196-4214-b7cf-5b17bdcdbe91 | 2 | public long inserir(Curso curso) throws Exception
{
String sql = "INSERT INTO curso(nome) VALUES (?)";
long idGerado = 0;
try
{
PreparedStatement stmt = ConnectionFactory.getConnection().prepareStatement(sql, Statement.RETURN_GENERATED_KEYS);
stmt.setString(1, curso.getNome());
stmt.executeUpdate()... |
5d758932-c68a-44c3-9db1-5bec833e45c2 | 7 | String outputFile(String inputFile) {
// Remove GZ extension
String base = Gpr.baseName(inputFile, ".gz");
// Remove extension according to input format
switch (inputFormat) {
case VCF:
base = Gpr.baseName(inputFile, ".vcf");
break;
case BED:
base = Gpr.baseName(inputFile, ".bed");
break;
def... |
a537dd55-3e95-413f-95c1-a787ff50e736 | 3 | public Vector<Object> getSegmentsVector(){
if(!checkConsolidate)this.consolidate();
ArrayList<Object> seg = this.segments;
Vector<Object> ret = null;
if(seg!=null){
int n = seg.size();
ret = new Vector<Object>(n);
for(int i=0; i<n; i++)ret.addElement(s... |
58882f4f-20df-4e69-8c8e-a10f2552b4b6 | 5 | public void save(String Filename)
{
Enumeration AllKeys;
PrintStream FileOutput;
String TempKey;
ArrayList<String> TempList;
boolean First = true;
// Try incase file input fails
try
{
FileOutput = new PrintStream(new FileOutputStream(Filename));
FileOutput.print(FileUtils.e... |
2410545f-b0a6-47e3-b58c-dd0c73aa6655 | 9 | void readProperties() throws Exception {
logger.log("Reading PROPARC properties records...");
while (readLine() != null
&& (line.length() < 10 || !line.substring(0, 10).equals("ENDPROPARC"))) {
if (line.length() >= 4 && line.substring(0, 4).equals("PROP"))
readProperty();
if (line.le... |
c95a9c38-c704-421d-8a1a-6b4b4c7832b2 | 5 | private static void lootRoom(Player player, Room[][] grid) {
if (grid[player.getLocationX()][player.getLocationY()].getRoomType()
.equals(RoomType.gold)) {
player.addScore(5);
System.out.println("You picked up some gold! Have a few points.");
grid[player.getLo... |
be179422-9864-49e4-9112-1aa208048fe1 | 8 | public int SearchStartChar(String FileText, int CharNumStart, char startChar) {
int i = 0;
char ch = ' ';
try {
i = CharNumStart;
while (i > 0) {
if (i == -1) {
i = 0;
break;
}
ch = Fi... |
6a7536ca-f42c-4942-9952-6e60aa8d354d | 9 | private double surfaceChargeDensity3(double psi){
double surCharDen = 0.0D; // temporary values of surface charge density
// bisection method
double sigmaAdsPos = 0.0D;
double sigmaAdsNeg = 0.0D;
for(int i=0; i<this.nonZeroAssocK; i++){
if(this.charges[indexK[i]]>... |
7d773bb3-c4e7-491e-a67f-c9f06e80e33b | 6 | @Override
public void invert(DenseMatrix64F A_inv) {
double []vv = decomp._getVV();
DenseMatrix64F LU = decomp.getLU();
if( A_inv.numCols != LU.numCols || A_inv.numRows != LU.numRows )
throw new IllegalArgumentException("Unexpected matrix dimension");
int n = A.... |
eca7d629-cd31-43bf-86d4-8d9591d3813d | 9 | public static Map<Row, Map<String, Set<String>>> parse(List<Row> companies, List<String> keyWords, String dir) {
Map<Row, Map<String, Set<String>>> companyKeywordMap = new HashMap<>();
if (keyWords == null || keyWords.isEmpty()) {
for (Row row : companies) {
companyKeywordMap... |
0ffb59c4-10ca-4f7c-95a4-d684bdb0012e | 5 | @Override
public String toString() {
StringBuilder s = new StringBuilder();
int empty = 0;
for (String s1 : notes)
if (s1.isEmpty())
empty++;
if (!(empty >= NOTESIZE && vol == 'q')) {
for (String s1 : notes) {
s.append(s1);
... |
abaf8d9c-70ca-4dae-a4fd-bae416c03ff3 | 9 | @Override
public void run() {
Thread thisThread = Thread.currentThread();
long beforeTime, timeDiff, sleep;
while (state == State.START && simulator == thisThread) {
for (Body b : list) {
calculateVectors(b);
calculateMovement(b);
}
checkCollision();
beforeTime = System.currentTimeMillis();... |
803b12da-fd01-470f-a939-b3788eea80b1 | 3 | private EnumSquareMazeCellDirection getPositionRelative(IMazeCell testCell)
{
EnumSquareMazeCellDirection result;
if (this.coordinates.x < testCell.getCoordinates().x)
{
result = EnumSquareMazeCellDirection.EAST;
}
else
{
if (this.coordinates.... |
606a4f0c-4784-4165-84e9-e1127a5cd064 | 8 | @Override
public void checkAllRestrictions(ModelSubInstance m)
throws RestrictionException {
ModelInstance meta = ModelInstance.getInstance();
Iterator<Map.Entry<Integer, ClassInstance>> it = meta.instanced_classes.entrySet().iterator();
while(it.hasNext()) {
ClassInstance c = it.next().getValue();
i... |
5d87d60a-eedf-4614-b7e5-ea730c2111f7 | 8 | public boolean equals(Object other) {
if (other instanceof Pair) {
Pair otherPair = (Pair) other;
return
((this.first == otherPair.first ||
(this.first != null && otherPair.first != null &&
this.first.equals(otherPair.first))) &&
... |
f1feccc2-c1ad-42bf-a69d-1000cef1b79b | 0 | public boolean isSolid() {
return solid;
} |
47e1d649-6316-41d9-8e93-ef176f6d6bdb | 9 | private boolean canVineStay(World par1World, int par2, int par3, int par4)
{
int var5 = par1World.getBlockMetadata(par2, par3, par4);
int var6 = var5;
if (var5 > 0)
{
for (int var7 = 0; var7 <= 3; ++var7)
{
int var8 = 1 << var7;
... |
de778f53-5c01-4316-b570-e4f596668613 | 1 | @Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((value == null) ? 0 : value.hashCode());
return result;
} |
76520476-20bb-4ef3-a01c-0bf760622549 | 8 | protected static Ptg calcAverage( Ptg[] operands )
{
Vector vect = new Vector();
for( Ptg operand : operands )
{
Ptg[] pthings = operand.getComponents(); // optimized -- do it once!! -jm
if( pthings != null )
{
for( Ptg pthing : pthings )
{
vect.add( pthing );
}
}
else
{
P... |
8e827f90-56ae-412a-9335-be4ffd80c3e9 | 0 | public void setTotal(double total) {
this.total = total;
} |
3b413b76-8fea-4544-b59e-ce6ec855019f | 8 | public void run() {
setSpeed(getCurBlockSpeed());
checkMove();
if (U == true) {
if (isBlocked(true, false, false, false) != true) {
c.moveUp(getSpeed());
c.setSpritePos(getCurSprite(true, false, false, false));
repaint();
checkEntity();
}
}
if (D == true) {
if (isBlocked(false, true, ... |
7bc80af1-72d5-4180-a9c0-cfed784a262d | 8 | @Override
public void e(float sideMot, float forMot) {
if (this.passenger == null || !(this.passenger instanceof EntityHuman)) {
super.e(sideMot, forMot);
this.W = 0.5F; // Make sure the entity can walk over half slabs,
// instead of jumping
return;
}
EntityHuman human = (EntityHuman) this.passe... |
30eb200d-0d12-4c89-be9c-e273044dbe2f | 0 | @Override
public void mouseClicked(MouseEvent e) {} |
b78df7fd-c986-448c-b3db-871075d820bf | 7 | public final boolean unlink(DragObject<?, ?, ?> object,
DropTarget<?, ?, ?> target) {
final Track t = (Track) object;
final MidiInstrumentDropTarget i = (MidiInstrumentDropTarget) target;
final Set<Integer> set = this.instrumentToTrack.get(target);
set.remove(t.getId());
if (set.isEmpty()) {
this.instru... |
576c315f-74f3-4329-9cb9-6fd1bbbc8535 | 5 | public static void main(String[] args) {
final int QUARTERS = 25;
final int DIMES = 10;
final int NICKELS = 5;
String choice = "y";
while (choice.equalsIgnoreCase("y")) {
int totalQuarters = 0;
int totalDimes = 0;
int totalNickels = 0;
... |
5d843a32-ac12-4150-b1ba-4bceb087075d | 7 | @Override
protected Void parse() throws IOException {
getProcessor().beginAccessor();
try {
whitespace();
while(peek() != -1) {
if(attempt('.')) {
List<String> names=new ArrayList<String>();
names.add(id());... |
a7f8e467-b759-4cf2-90d5-2bb6a9495ccb | 8 | public static void main(String[] args) {
QueueSimulation queueSimulation = new QueueSimulation();
SimulationFrame frame = new SimulationFrame();
String s = " ";
//simulare pentru 180 de secunde
for(int j = 0; j < simulationInterval; j++){
... |
afbfb220-ab19-4db6-8e2f-6411ad96d5a1 | 8 | private static void sort(Node[] src, Node[] dest, int low, int high) {
int length = high - low;
if (length < 7) {
for (int i = low + 1; i < high; i++)
for (int j = i, k = i - 1; j > low && (dest[k].weight > dest[j].weight); --j, --k) {
Node t = dest[j];
... |
9028ccfd-2356-4910-836a-c93853a3630e | 7 | public ParameterParser(String[] args) {
for (int i = 0; i < args.length; i++) {
if (parseFlags(args[i])) {
continue;
}
if (args[i].matches("--network-config") && args.length > i + 1) {
networkConfigFile = args[++i];
} else if (args[i].matches("--speed") && args.length > i + 1) {
speedFactor =... |
cbf9d1a1-7ba0-4f96-b4e5-8adff61d7cbe | 4 | void createExampleWidgets () {
/* Compute the widget style */
int style = getDefaultStyle();
if (topButton.getSelection ()) style |= SWT.TOP;
if (bottomButton.getSelection ()) style |= SWT.BOTTOM;
if (borderButton.getSelection ()) style |= SWT.BORDER;
/* Create the example widgets */
tabFolder1 = new ... |
e7ab0993-3ead-4f39-9634-f54ce006b9b2 | 6 | public static BinaryTreeNode<Integer> sinkZero(BinaryTreeNode<Integer> root) {
if(root == null) {
return root;
}
sinkZero(root.left);
sinkZero(root.right);
//check if root's data is zero
if(root.data.compareTo(0) == 0){
// if either of the child i... |
14661f89-2191-4207-a9c7-d8769e87e444 | 1 | public void map_abs_interact_click(int x, int y, int mod) {
Gob pgob;
synchronized (glob.oc) {
pgob = glob.oc.getgob(playergob);
}
if (pgob == null)
return;
Coord mc = new Coord(x, y);
wdgmsg("itemact", JSBotUtils.getCenterScreenCoord(), mc, mod);
} |
17a21e43-15df-4307-a29d-1bbf45b93837 | 5 | public static int fillMinCost(int size, int amount) {
minCost = new int[size + 1];
Arrays.fill(minCost, INF);
int index = size;
minCost[0] = 0;
for (int i = 0; i < V.length; i++)
for (int j = size-V[i]; j >= 0; j--) {
if (minCost[j] != INF)
minCost[j + V[i]] = Math.min(minCost[j + V[i]], minCos... |
cd7cdc9e-5a07-4520-8412-064df2db9e73 | 1 | public POA _default_POA()
{
if (_poa != null)
{
return _poa;
}
else
{
return super._default_POA();
}
} |
42e56e57-974d-482d-b1b0-543e19f1d4b2 | 9 | private void fixupSuccessor(int lastIndex, int insertIndex, int runIndex, int runCount, int ebc, int successorEbc) {
if (insertIndex > runIndex) {
putRunCount(runIndex, insertIndex - runIndex);
}
//
// Test whether fixup is in the middle or at the end of a run
//
... |
edf71dce-a4fd-4f9b-b190-11a0c69df962 | 6 | public AdvancedShifter(int num_bits, boolean is_left) {
super(null);
bitness = num_bits;
int num_ctrls = (int)Math.ceil(Math.log(num_bits+0.1)/Math.log(2));
inNOPs = new NOPNode[num_bits];
ctrlNOPs = new NOPNode[num_ctrls];
shifters = new Shifter[num_ctrls];
muxs = new MultiMux[num_ctrls];
for (int i = ... |
dd0de160-86a1-4907-a31b-56a66c89ca16 | 4 | public static <T> Statistic from(List<T> afterValueItems, List<T> beforeValueItems, ValueExtractor<T> valueExtractor) {
long max = 0, min = 0;
double sum = 0;
for (int i = 0; i < afterValueItems.size(); i++) {
long beforeValue = valueExtractor.getValue(beforeValueItems.get(i));
... |
0e0d5775-4a0f-4abc-8f39-29b0f42a8dcc | 0 | public String getName() {
return name;
} |
f51ba89e-4522-48a4-964e-5c11da9bad9f | 6 | public void printStep(Coordinate c, int xPos, int yPos) {
String as = "#", bs = "C", cs = "O";
String p;
int fieldsize = 50;
System.out.println("Coordinate: ("+c.getXCoordinate()+"|"+c.getYCoordinate()+") xPos: "+xPos+" yPos: "+yPos);
for(int a=-fieldsize;a<fieldsize;a++) {
for(int b=-fieldsize;b<fie... |
86e5cd90-7854-4e09-bb87-ea87159d2b96 | 0 | @POST
@Path("addEvent")
@Consumes(MediaType.APPLICATION_JSON)
public void addEvent(Event e){
System.out.println("Add an event to DB");
JpaTest.eventService.addEvent(e);
} |
a6098d8c-161c-49a0-a549-b8cefea3e35c | 9 | public Object getValue(String key) {
if (key.equalsIgnoreCase("state")) {
switch (type) {
case ToggleFieldAction.E_FIELD:
ElectricField ef = (ElectricField) model.getNonLocalField(ElectricField.class.getName());
if (ef != null) {
int i = 0;
switch (ef.getOrientation()) {
case VectorField.... |
58a82923-e772-4141-a1b3-84725cc4e690 | 1 | public Polygon translate(Coordinate t) {
Coordinate[] res = new Coordinate[this.corners.length];
for(int i=0; i<this.corners.length; i++)
res[i] = this.corners[i].add(t);
return new Polygon(res);
} |
b1b6da0a-c6db-4d1f-8897-2eb1afcc8644 | 7 | public String formatTag(int i, XMLNode xmlnode)
{
String s = "";
switch(xmlnode.XMLType)
{
default:
break;
case 0: // '\0'
s = s + "<" + xmlnode.XMLData;
if(!xmlnode.XMLAttr.equals(""))
s = s + xmlnode.XMLAttr;
... |
6b50d8e0-5b3f-452d-8346-69a75a524305 | 1 | public static Line getLineIfAvailable(Mixer mixer, Line.Info lineInfo) {
try {
return mixer.getLine(lineInfo);
} catch (LineUnavailableException ex) {
return null;
}
} |
35e9fc4b-a83f-42b5-bce4-ddbc0f8583bb | 0 | @Override
public boolean existsLockWrite(Long connectionId, String objectType) {
return writeLocks.contains(objectType + lockSeparate + connectionId);
} |
9d30b299-afa9-4e15-9746-a0159ab14a9f | 1 | public void renderObjects(Graphics g) {
for (int i = 0; i < objects.size(); i++) {
tempObject = objects.get(i);
tempObject.render(g);
}
} |
f30efca9-fb96-4bd3-892f-39e79402fb5f | 6 | int numConnected(Piece p, int x, int y, boolean[][] board){
if(x<0 || x>=board.length || y<0 || y>=board[0].length || !board[x][y])
return 0;
board[x][y] = false;
int[] nums = {
numConnected(p,x+1,y,board),
numConnected(p,x-1,y,board),
numConnected(p,x,y+1,board),
numConnected(p,x,y-1,board),
... |
10f76836-d62f-4506-a9db-71949883adb7 | 3 | public void run(){
init();
long lastTime = System.nanoTime();
final double amountOfTicks = 60.0;
double ns = 1000000000 / amountOfTicks;
double delta = 0;
int updates = 0;
int frames = 0;
long timer = System.currentTimeMillis();
while(running){
long now = System.nanoTim... |
7c5c0425-2961-4250-b3d5-d84bc4e32b4f | 7 | private void buildWindow() {
JTabbedPane tabPane = new JTabbedPane();
JPanel mainTab = new JPanel();
JEditorPane aboutText = new JEditorPane();
try {
aboutText.setPage(getClass().getResource("/docs/about.html"));
} catch (IOException ex) {
}
aboutTex... |
687f54a9-bbc7-474b-979d-b998c38b7b6a | 6 | public void onEnable() {
try {
url = new URL("http://ahniolator.aisites.com/visitors/visit.php?v=" + this.getDescription().getVersion());
} catch (MalformedURLException ex) {
}
dir = this.getDataFolder() + File.separator;
dataDir = dir + "data" + File.separator;
... |
24c66f14-1ec5-4449-b591-d803437934a3 | 4 | @Override
protected void setKeyBindings() {
super.setKeyBindings();
im.put(KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, 0), KeyEvent.VK_ENTER);
im.put(KeyStroke.getKeyStroke(KeyEvent.VK_SPACE, 0), KeyEvent.VK_SPACE);
im.put(KeyStroke.getKeyStroke(KeyEvent.VK_D, 0), KeyEvent.VK_D);
... |
33f7e5b7-05c3-4445-acd8-13f27bcf7e72 | 4 | @Test
public void testManyGames(){
Dealer dealer = new Dealer();
Player player1 = new RandomPlayer("Alice");
Player player2 = new SimplePlayer("Bob");
Player player3 = new ThresholdPlayer("Carol");
dealer.addPlayer(player1);
dealer.addPlayer(player2);
dealer.addPlayer(player3);
int player1Earnings = 0;... |
182b5265-1a0a-45ee-9353-af4e20249ca6 | 1 | protected Integer[] getActions() {
ArrayList<Integer> alstActions = new ArrayList<>();
if(pressedKeys.contains(KeyEvent.VK_SPACE)){
alstActions.add(ACTION_SHOOT);
}
return alstActions.toArray(new Integer[0]);
} |
1757bd2b-c4b1-47e2-84c9-a74cfbbd6835 | 1 | public void Save()
{
try {
DataWorker.Instance().SaveObject(this);
} catch (IllegalAccessException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
} |
932facb3-0113-4173-bf48-557b0d499384 | 4 | public static void removeMeetingRoom(int meetingID){
try {
if(conn == null || conn.isClosed()){
conn = DatabaseConnection.getConnection();
}
} catch (SQLException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
try{
conn.setAutoCommit(fa... |
5671c63b-c019-4854-b14e-3dbee88720d0 | 9 | public synchronized void start() throws Exception {
if (thread != null) {
throw new Exception("Slave Listener already started.");
}
thread = new Thread(new Runnable() {
/** run()
*
* Listens for requests from the ProcessManager
* Interprets the requests and responds to them
*/
@Overri... |
a2a0606a-fcf6-47f9-8ee7-45628576a44c | 6 | private void jTextField7FocusLost(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_jTextField7FocusLost
// TODO add your handling code here:
if ((evt.getOppositeComponent()!=jTextField3) &&
(evt.getOppositeComponent()!=campoFecha1) &&
(evt.getOppositeComponent()!=campoFecha... |
a64fe55b-7932-42eb-8d01-773f4a288ff3 | 7 | public boolean isPalindrome(String s) {
if (s == null || s.equals(""))
return true;
s = s.toLowerCase();
StringBuilder sb = new StringBuilder();
for (int i = 0; i < s.length(); ++i) {
if (s.charAt(i) >= 'a' && s.charAt(i) <= 'z') {
sb.append(s.charAt(i));
}
}
s = sb.toString();
for (int i = 0... |
b853a88f-3209-4aa9-bf4a-55763df10685 | 5 | public void look(Player p) {
try {
//Name in green text
Telnet.writeLine(p.getSocket(), "<fggreen>" + name + "<reset>");
//Description in regular text.
Telnet.writeLine(p.getSocket(), description);
//Loop through listing all characters that are here in cyan text
String playerList = "<fgcyan>... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.