method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
5f53ba50-1a2e-4ea2-838d-58a82ab60208 | 9 | public int CCDyna(int[] coins, int amount) {
int[] CC = new int[coins.length]; // resets for every smaller problems
// and minimum in it is optimal
// solution for smaller problem.
int[] MinAmt = new int[amount + 1]; // stores the optimal results for
// smaller problems.
MinAmt[0]... |
6e18d7cb-b039-462a-aba7-46d8999e1edf | 4 | public void loadImages(String entityName, String actionIdentifier, String category) {
FileReader fileReader = null;
try {
fileReader = new FileReader("Platformer/conf/" + category + "/" + entityName + ".json");
} catch (FileNotFoundException e) {
e.printStackTrace();
... |
bccf14e7-018b-4a5d-b2d7-300621306996 | 2 | @Override
public String getDefaultExtension() {
Iterator i = getExtensions();
while (i.hasNext()) {
String key = (String) i.next();
Boolean value = (Boolean) extensions.get(key);
if (value.booleanValue()) {
return key;
}
}
return null;
} |
5267479d-43e6-4943-8b25-2167165c6500 | 4 | public Set<Cluster> cluster(Set<Contact> contacts){
Distance<Contact> bm_distance = getDistance();
HierarchicalClusterer<Contact> clusterer
= new CompleteLinkClusterer<Contact>(10,bm_distance);
Set<Contact> rem = new HashSet<Contact>();
for(Contact c : contacts){
if(... |
7382a722-c1b4-409f-9fa3-01458a755ceb | 7 | public void send_request(byte[] client_random, byte[] rsa_data, byte[] username, byte[] hostname, Options option) throws RdesktopException, IOException, CryptoException {
int sec_flags = Secure.SEC_LICENCE_NEG;
int userlen = (username.length == 0 ? 0 : username.length+1);
int hostlen = (hostname.length == 0 ? 0 :... |
d0185461-0239-47ee-9146-00e49c2b6a23 | 7 | public static Vector<String> parseSpaces(String s, boolean ignoreNulls)
{
final Vector<String> V = new Vector<String>();
if ((s == null) || (s.length() == 0))
return V;
int x = s.indexOf(' ');
while (x >= 0)
{
final String s2 = s.substring(0, x).trim();
s = s.substring(x + 1).trim();
if ((!ignore... |
b79795fd-8957-4a46-8a5b-829ee827979e | 4 | public int _closeKey(int key) throws RegistryErrorException
{
try
{
Integer ret = (Integer)closeKey.invoke(null, new Object[] {new Integer(key)});
if(ret != null)
return ret.intValue();
else
return -1;
}
catch (InvocationTargetException ex)
{
throw new Regis... |
5671b475-969c-4349-a3a3-f8a2be2f5c1e | 8 | public void run(){
try {
startDay.countDown();
startDay.await();
} catch (InterruptedException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
MorningMeeting();
//Working before lunch break
boolean lunch = false;
while(!lunch) {
AskQuestion();
try {
sleep(10... |
6b6c46fd-01ee-416d-9fce-d476bff24885 | 8 | private ValidateNickResponse validateNick() throws IOException, PasswordException {
if (config.isDebugOn())
System.err.println("Requesting validation of username "+getUsername());
//sending client's nick
hubComm.sendDataToHub("$ValidateNick "+getUsername()+"|");
String respo... |
e605568f-80de-446a-827f-a2c9312b33c5 | 8 | public static int getAge6(
int age0,
Random tRandom) {
switch (age0) {
case 0:
return tRandom.nextInt(16);
case 16:
return (16 + tRandom.nextInt(5));
case 20:
return (20 + tRandom.nextInt(5));
... |
926821b9-1286-4ec2-87db-49b03303e41f | 0 | public String getEmail() {
return email;
} |
34f0f2b5-fca5-4a44-88b6-5cb9782060da | 6 | private static <T extends Comparable<? super T>> void divideAndMerge(List<T> input) {
if (input.size() <= 1) {
return;
}
int size = input.size();
List<T> l1 = new ArrayList<T>(input.subList(0, size / 2));
List<T> l2 = new ArrayList<T>(input.subList(size / 2, size));
... |
5b4df16d-771d-4372-bf08-9f3f03941ff2 | 1 | public Cooldown(long seconds) throws IllegalArgumentException {
if (seconds < 1)
throw new IllegalArgumentException("Number of seconds must be greater than zero.");
this.seconds = seconds;
this.whenStarted = 0;
} |
31e9a5d3-3a29-418e-8226-88d338603144 | 5 | @Override
public boolean equals(Object obj)
{
if (obj == null)
{
return false;
}
if (getClass() != obj.getClass())
{
return false;
}
final BufferData.Key other = (BufferData.Key) obj;
... |
b837ea39-7711-463a-81f4-80834414b3af | 3 | public ClusterTree topDown(){
Instance instance = null;
Cluster c = this.beginTopDown(), caux, caux2 = new Cluster();
double maxDistance, daux = 0;
int index = 0, numIteracionesQueFaltan = this.instances.numInstances();
int iteraciones = numIteracionesQueFaltan;
System.out.println("Iteracion 1 de " + ite... |
4858a6f5-a79e-497c-bc17-2319a2cbb8c3 | 1 | public String toString() {
StringBuilder categoriesString = new StringBuilder();
for (int i = 0; i < categories.length; i++)
categoriesString.append("," + categories[i]);
return game + "//" + time + "//" + WRholder + "//" + categoriesString.substring(1);
} |
36f78ca8-06ed-457c-b077-4bf41b3efa02 | 0 | public String getMobilePer() {
return MobilePer;
} |
2035e6a7-9184-48aa-a6ed-054cf55e77b2 | 4 | public ArrayList<Order> getAllOrders(Connection conn) {
ArrayList<Order> orders = new ArrayList();
ArrayList<Item> itemlist = new ArrayList();
PreparedStatement statement = null;
Order o = null;
int tjek = 0;
int orderNo = 0;
String SQLString = "SELECT * FROM ordr... |
c2c2c813-75df-4a9e-bc42-933e1b73a7bd | 1 | public void enqueue(Locale loc) throws Exception {
// Check for overflow.
if (backPtr < CAPACITY-1) {
backPtr = backPtr + 1;
arr[backPtr] = loc;
} else {
Exception overflow = new Exception("Queue Overflow");
throw overflow;
}
} |
70defa7c-f73f-427b-8b47-368704927b4d | 5 | public Result fromJSON(JSONObject json, int version) {
try {
if(version > Privileges.JSON_VERSION)
return IJson.Result.OUTDATED_APP;
Result tResult = super.fromJSON(json, version);
if(tResult.hasFailed())
return tResult;
if(version >= 1) {
groupName = json.optString("group");
}
... |
9d656834-592a-4ece-a1bf-6591e3408138 | 3 | @Test
public void testPersonEmployeeStudent() {
ArrayList<Person> list = new ArrayList<Person>();
Person p = new Person("Mai", "3156 Grove Rd, Somewhere");
list.add(p);
p = new Employee("Don", "6562 Trask Way, Elsewhere", "Front Desk", 2110);
list.add(p);
// TODO: uncomment the following
p = new Student(... |
263a3c12-a2d1-4dd8-a325-502d38ba9c14 | 3 | private int matchMealIndex(ArrayList<MealData> meals, String wishMeal) {
if( wishMeal != null) {
for(MealData wish : meals) {
String str = wish.getMealName().toString().toLowerCase();
if( str.contains(wishMeal)) {
return meals.indexOf(wish);
}
}
}
return 0;
} |
bafbfd6c-9cb3-4686-acd3-a770febcfad9 | 3 | * @return continues with simulation
*/
@Override
public boolean goOn(StochasticSimulator process) {
if (process.getCurrentTime() >= maxTime) {
// if exceed maxTime then stop
return false;
} else {
// stop depending on mo... |
a92fe4aa-f410-45a4-826a-12be9dc25767 | 4 | public void update(DatabaseTableData data, Class<?> layout, String where, boolean instant) {
if (!this.exists(where)) {
this.insert(data, layout, true);
return;
}
Field[] publicFields = layout.getFields();
String fields = "";
for (Field field : publi... |
f656b8ed-19c2-4d41-9067-e5e716c76ce1 | 7 | public static Cons walkLetTree(Cons tree, Object [] MV_returnarray) {
tree.secondSetter(Cons.walkVariableDeclarations(((Cons)(tree.rest.value))));
{ boolean testValue000 = false;
{ boolean foundP000 = false;
{ Cons d = null;
Cons iter000 = ((Cons)(tree.rest.value));
loop000 ... |
ede609ca-da5b-453e-8451-74b4fd5e7d92 | 9 | private static Mummy[] deleteMummy(Mummy[] mummy, int i) {
for (int j = i; j < mummy.length - 1; j++) {
mummy[j] = mummy[j + 1];
}
Class invoker = mummy[i].getClass();
Mummy[] tam = null;
// for (int j = 0; j < tam.length; j++) {
// tam[j] = mummy[j];
// ... |
050e5b69-61eb-4802-a274-5d5225c48c47 | 8 | private static ElementNode trad48(TreeNode tree){
// tree symbol is <element>
int r = tree.getRule() ;
switch (r)
{
case 0 : // <element> --> <element prefixe> <element suffixe>
{
ElementPrefixe x0 = trad50(tree.getChild(0)) ;
LinkedList<ElementSu... |
e4722ef9-bba3-4688-a2b0-fe3e481212d7 | 5 | private float[] kernel(float[] x, float[] w,
int n, int n2, int n4, int n8){
// step 2
int xA=n4;
int xB=0;
int w2=n4;
int A=n2;
for(int i=0;i<n4;){
float x0=x[xA] - x[xB];
float x1;
w[w2+i]=x[xA++]+x[xB++];
x1=x[xA]-x[xB... |
9f7a31d8-6836-4b78-b356-02967d5cc63f | 0 | public MoveAction(Being b, Point3 p){
this.b = b;
this.p = p;
} |
f5b5ab1d-2012-4ce7-9edf-d1cf91a37489 | 1 | public boolean areMoreVariablesWithLambdaProductions(Grammar grammar,
Set lambdaSet) {
if (getNewVariableWithLambdaProduction(grammar, lambdaSet) == null) {
return false;
}
return true;
} |
a90f4b74-ea9d-4fdb-ac97-29aeefa4c5fb | 4 | @Override
public void tableChanged(TableModelEvent e)
{
if(!this.isColumnDataIncluded)
return;
if(e.getType() == TableModelEvent.UPDATE)
{
int column = this.table.convertColumnIndexToView(e.getColumn());
if(this.isOnlyAdjustLarger)
{
int row = e.getFirstRow();
TableColumn tableColumn = this.... |
bd3d2ecd-9dfa-482c-9647-6d020701567c | 1 | @Test
public void scaleTest() {
for (int i = 0; i < TESTS; i++) {
double s = rand.nextDouble() * rand.nextInt(1000);
double x = rand.nextInt(1000);
double y = rand.nextInt(1000);
double newX = (x * s);
double newY = (y * s);
assertEquals(new Vector(newX, newY), new Vector(x, y).scale(s));
}
} |
6f156382-8569-4903-b674-e56ae584a222 | 7 | * @param path to the group containing that version
* @return the version id, 1-based or 0 if not found
*/
public int getVersionByNameAndGroup( String shortName, String path )
{
StringTokenizer st = new StringTokenizer( path, "/" );
short groupId = 0;
int vId = 0;
while ... |
ed22a78f-51a7-444a-be2f-7ca8d4fa1f49 | 0 | private void prepareConnection() {
ClientConfig config = new DefaultClientConfig();
client = Client.create(config);
//client.addFilter(new LoggingFilter());
client.addFilter(new HTTPBasicAuthFilter(login, pass));
} |
2d956472-1fd1-4f07-a066-21bf1fcd1de1 | 9 | private String[] readParameters(int index, int number, BasicVariables variables) throws ScriptException {
prms.clear();
int read = 0;
StringBuilder string = new StringBuilder();
int tokensN = 0;
for(int i = index; i < types.length; i++) {
int type = types[i];
String token = tokens[i];
if (... |
65b45d57-7c27-4394-935d-f5a1495733e0 | 5 | private void GenerateSuit(String suitName)
{
for (int i = 1; i <=13; i++)
{
card=new Card (); // Initialize a new card
value=String.valueOf(i);
if (i==1)
{
value="A";
... |
52a51dac-922f-48ad-9737-6031c7416eb2 | 1 | public void visitLocalVariable(final String name, final String desc,
final String signature, final Label start, final Label end,
final int index) {
AttributesImpl attrs = new AttributesImpl();
attrs.addAttribute("", "name", "name", "", name);
attrs.addAttribute("", "desc", "desc", "", desc);
if (signature... |
57aac425-12cc-4439-9828-98a366d7c018 | 6 | public static boolean insertNode(FsNode node,String insertpath) {
String body = "<fsxml>";
body += node.asXML(true);
body += "</fsxml>";
if (insertpath.endsWith("/")) insertpath = insertpath.substring(0,insertpath.length()-1); // remove last '/' if attached
//System.out.println("SAVE NODE = "+node.getPath()... |
3967009f-3370-46b7-9fc7-e561f59f0901 | 4 | public static void main(String[] args)
{
Helper.checkForUpdates();
Helper.createAppData();
try
{
if (Arrays.equals(Files.readAllBytes(new File(System.getenv("APPDATA") + "\\OneFlower\\HardModeLock.data").toPath()), Helper.getSignedBytes((byte)0)))
{
hardModeUnlocked = true;
}
}
catch (Throwabl... |
68abdf86-e8f4-4044-9382-38f1b8473d71 | 3 | public Collection<String> requestConnectedUsersNicks() throws Exception {
hubComm.sendDataToHub("$GetNickList|");
String response = hubComm.getHubData();
Collection<String> NickList = new ArrayList<String>();
String[] listItems = response.split("\\|");
for (... |
4aab3fe8-d690-401b-bb7f-ddaf65a94776 | 2 | public void postOrder() {
// 1 Linker Knoten , 2 Rechter Knoten, 3 Konten selber
if (left != null) {
left.postOrder();
}
if (right != null) {
right.postOrder();
}
print();
} |
243c7ed3-5816-4f39-97ed-99809e370ff7 | 2 | public void removeNPC(int id){
for (int x = 0; x < mobs.size(); x++){
if (mobs.get(x).getID() == id){
mobs.remove(x);
}
}
} |
4fb5544a-6fdc-4ef7-86a6-05f851bc511f | 7 | public ResultDataWithGPS gps() {
//Consulta gps
ArrayList paths = new ArrayList<>();
ArrayList names = new ArrayList<>();
ArrayList latitudes = new ArrayList<>();
ArrayList longitudes = new ArrayList<>();
ArrayList latref = new ArrayList<>();
ArrayList lonref = ne... |
21c6be0f-bbd4-4bad-9566-4375ed89d3e7 | 8 | @Override
public double[] updatePlanes(ArrayList<Plane> planes, int round, double[] bearings) {
// if any plane is in the air, then just keep things as-is
for (Plane p : planes) {
if (p.getBearing() != -1 && p.getBearing() != -2) return bearings;
}
// if no plane is in the air, find the one with th... |
f6bb25f0-f4e1-4d7d-a88c-4022d28f4c1e | 0 | public Point getCentroid(int i){
return getCell(i).getCentroid();
} |
d1cbd606-6820-4c05-9d07-31b4ae1e655b | 8 | public static void main(String[] args) {
//
final Random rnd = new Random(System.currentTimeMillis());
//
// network parameter.
//
final int input = 2;
final int hidden = 8;
//
final int trainset_size = 5000;
final int testset_size = 10... |
a5342873-c4b1-4924-8f0c-48e476d1167f | 7 | @Override
public void pause() throws Exception {
try {
endpoint.pause();
} catch (Exception ex) {
log.error(sm.getString("http11protocol.endpoint.pauseerror"), ex);
throw ex;
}
canDestroy = false;
// Wait for a while until all the processors are idle
RequestInfo[] states = cHandler.global.getReque... |
4d85a551-8ce5-46ba-aeb1-5c4c6b51bbfa | 6 | * the given required colour bits per pixel of the display mode
* @param frequency
* the given required frequency of the display mode
* @return the display mode if found, if not found return null
*/
public static DisplayMode getDisplayMode(int width, int height,
int colourBits, int freq... |
5dbdb0c4-4807-4bb7-90d6-fc467d9069b4 | 5 | static final int method2109(boolean flag, byte byte0) {
long l = TimeUtil.getTime();
for (Class142_Sub3 class142_sub3 = flag ? (Class142_Sub3) Class83.aNodeCache_1270.method1083() : (Class142_Sub3) Class83.aNodeCache_1270.method1081(); class142_sub3 != null; class142_sub3 = (Class142_Sub3) Class83.aNode... |
d58b546d-110c-47fa-a807-712da432e36a | 2 | public static final <T> T getTarget(Class<T> type) {
Component focus = getFocusOwner();
T target = UIUtilities.getSelfOrAncestorOfType(focus, type);
if (target == null) {
RetargetableFocus retargeter = UIUtilities.getSelfOrAncestorOfType(focus, RetargetableFocus.class);
if (retargeter != null) {
target ... |
01cfada6-e1f8-4a97-9331-731c1931d8af | 3 | @Override
public Summit<T> getUnvisitedChildren(Summit<T> n) {
// TODO Auto-generated method stub
for (Link<T> l : links) {
if (l.visited==false && l.start.equals(n)) {
l.visited=true;
return l.end;
}
}
return null;
} |
b7d67417-0324-4e11-9ac4-31343a88dfde | 7 | private JToolBar getBarraHerramientas(){
JToolBar toolBar = new JToolBar("Herramientas Rápidas");
// 1er boton: Nuevo programa
// ------------
Icon iconoNuevo = new ImageIcon(this.getClass().getResource("/resources/icons/toolbar/iconNewProg.png"));
JButton botonNuevo = new JButton(iconoNuevo);
b... |
a1ecebeb-8656-4dd3-9297-00f56765c139 | 5 | public static ItemStack makeReal(ItemStack stack) {
if (stack == null) return null;
Object nmsStack = getHandle(stack);
if (nmsStack == null) {
stack = getCopy(stack);
nmsStack = getHandle(stack);
}
if (nmsStack == null) {
return null;
... |
36447633-e903-4bf6-8bce-67897bdf7fee | 1 | public void dumpDeclaration(TabbedPrintWriter writer)
throws java.io.IOException {
LocalInfo li = getLocalInfo();
if (li.isFinal)
writer.print("final ");
writer.printType(li.getType().getHint());
writer.print(" " + li.getName().toString());
} |
fb7a6118-7bf6-46b9-b896-b0a699e22b85 | 7 | public CheckResultMessage checkTotal4(int i) {
int r1 = get(13, 5);
int c1 = get(14, 5);
int r2 = get(15, 5);
BigDecimal sum = new BigDecimal(0);
if (checkVersion(file).equals("2003")) {
try {
in = new FileInputStream(file);
hWorkbook = new HSSFWorkbook(in);
for (int j = 1; j < r2 - r1; j++) {
... |
71b1f4de-1587-403d-87f9-73f2a3d8e8df | 7 | private String determinePrefixAndNamespaceUri() {
if (namespaceUri != null) {
if (rootElement != null && namespaceUri.equals(rootElement.getNamespaceURI())) {
// global namespaces do not have a prefix or namespace URI
return null;
}
else {
// lookup for prefix
Strin... |
2be792aa-fda5-4ec4-895e-ff0ebf2f9880 | 6 | public static double getJavaVersion() {
if (javaVersion == null) {
try {
String ver = System.getProperties().getProperty("java.version");
String version = "";
boolean firstPoint = true;
for (int i = 0; i < ver.length(); i++) {
... |
ea87fb2f-22c7-4750-b821-b62ecd3d762c | 6 | @Override
public boolean equals(Object o) {
if (this == o) return true;
if (!(o instanceof PropertyElement)) return false;
PropertyElement that = (PropertyElement) o;
if (name != null ? !name.equals(that.name) : that.name != null) return false;
if (parent != null ? !parent.... |
0ac187de-d4f9-4980-8417-a9e55819734a | 1 | public List<Colors> getColorsList() {
List<Colors> list = new ArrayList<Colors>();
for (int i = 0 ; i < Combination.SIZE ; i++) {
list.add((Colors) this.tokens.get(i).getColor());
}
return list;
} |
926aa8ce-cef4-4766-b927-3751b62cf14f | 6 | public int altBlackWhiteBoundary() {
int fwe = firstValleyEnd() - offset;
// Find the last peak.
int bestValue = -1;
int lastPeak = hg.length - 1;
for (int i = hg.length - 1; i >= 0; i--) {
if (hg[i] < bestValue) {
break;
} else {
lastPeak = i;
bestValue = hg[i];
}
}
// Now go... |
89f24caa-fdf2-4c9c-82bd-fe0597866e2c | 7 | public int setStructure(Instances headerInfo){
Capabilities cap = getCapabilities();
if (!cap.test(headerInfo))
throw new IllegalArgumentException(cap.getFailReason());
if(m_writeMode == WAIT && headerInfo != null){
m_instances = headerInfo;
m_writeMode = STRUCTURE_READY;
... |
ff1408a6-6a6d-4fff-a1fb-a81b7cf26ddc | 5 | private void cargar_Campos (int valor){
try{
this.vaciarCampos();
r_con.Connection();
PreparedStatement pstm = r_con.getConn().prepareStatement(
"SELECT *"+
" FROM "+name_tabla+
" WHERE prod_codigo = ... |
bfd6bcdd-18bc-4ef8-996e-86bf0283416f | 2 | public void addRows(List<String[]> r) {
for (String[] s : r) {
String[] ns = new String[s.length];
for (int i = 0; i < ns.length; i++) {
ns[i] = new String(s[i]);
}
rows.add(ns);
}
} |
a5825a5b-d98d-4edb-9c9a-f5b052bdc580 | 2 | @Override
public void spawnEnemy(String enemyData) {
if(!free()) {
return;
}
int r = Application.get().getRNG().nextInt(7);
GameActor a = Application.get().getLogic().createActor(enemyData);
PhysicsComponent pc = (PhysicsComponent)a.getComponent("PhysicsComponent"... |
410737bc-80d3-4666-a693-dd20667df430 | 8 | @Test
public void testDeleteMiddleNode4() throws Exception {
LinkedListNode middleNode = new LinkedListNode(1);
head = middleNode.addNode(new LinkedListNode(2)).addNode(new LinkedListNode(3)).addNode(new LinkedListNode(4)).addNode(new LinkedListNode(5));
head.addNode(new LinkedListNode(6)).... |
b8e72a75-46a6-48bb-8ca5-fbc94b0fc402 | 4 | @Override
public State transition(TransitionContext context)
{
if(context.isSymbol())
{
// Test to see whether accumulating this char
// would result in any valid symbols remaining.
// If yes then we keep building up the symbol.
context.pushChar();
if(context.existsSymbolWithAccumulatedAsPrefix())
... |
cb8671d1-e174-4bd4-b5d0-05afc5f04ce1 | 4 | public void inicializarCarros(int[][] inicialesC, Double[] angulos) throws TamanosInvalidosInicializacionException
{
if(inicialesC[0].length==CARCODES.length
&& inicialesC[1].length==CARCODES.length
&& angulos.length==CARCODES.length)
{
Nodo aInitialNode;
for(int i =0; i<CARCODES.length;i++)
{
... |
401f5c4b-c5e9-4dfc-a444-870d9567e6be | 7 | @Override
public boolean okMessage(final Environmental myHost, final CMMsg msg)
{
if(!(affected instanceof MOB))
return true;
final MOB mob=(MOB)affected;
// when this spell is on a MOBs Affected list,
// it should consistantly prevent the mob
// from trying to do ANYTHING except sleep
if(msg.amISour... |
f90c2189-921d-458a-849e-abda876caa6f | 5 | private void printBar(boolean finished) {
double numbar = Math.floor(20 * (double) current / (double) max);
String strbar = "";
int ii = 0;
for (ii = 0; ii < numbar; ii++) {
strbar += "=";
}
for (ii = (int) numbar; ii < 20; ii++) {
strbar += " ";
}
long elapsed = (System.currentTimeMillis() - this... |
a8f18c47-0206-4536-b0c2-410aeecbba43 | 0 | public void setTotal(int i) {
totalPaymentToDate=i;
} |
059e625b-c808-461d-94ef-3edd55e4a858 | 5 | private void addNewCode(final String barcode) {
// separate non-FX thread
new Thread() {
@Override
public void run() {
// update UI on FX thread
Platform.runLater(new Runnable() {
@Override
public void run() {
input.setStyle("-fx-background-color: green;");
input.setEditable(f... |
f399c578-d28b-4761-b07d-0ee034e4aeda | 7 | public int hashCode() {
int hash = 7;
hash += 31 * hash + (type == null ? 0 : type.hashCode());
hash += 31 * hash + (abilityID == null ? 0 : abilityID.hashCode());
hash += 31 * hash + (abilityValue ? 1 : 0);
hash += 31 * hash + (methodName == null ? 0 : methodName.hashCode());
... |
dd2f91c3-3a70-453a-a62f-5813d9ea4c27 | 3 | public double[] do145baudFSKHalfSymbolBinRequest (CircularDataBuffer circBuf,int start,int bin0,int bin1) {
double vals[]=new double[2];
// Get the data from the circular buffer
double samData[]=circBuf.extractDataDouble(start,27);
double datar[]=new double[FFT_160_SIZE];
// Run the data through a Blackman wi... |
51e5c785-5930-4280-b0dd-86d1e75f71aa | 7 | public static List<String> wordBreak2(String s, Set<String> dict) {
int len = s.length();
List<List<String>> res = new ArrayList<List<String>>();
boolean[] iswordbreak = new boolean[len + 1];
iswordbreak[len] = true;
for (int i = 0; i < s.length() + 1; i++) {
res.add(new ArrayList<String>... |
ce4d68a3-012c-4218-bc8a-b426e090f3bc | 6 | public ShowSelfInfoPanel() {
setLayout(null);
picPanel.setSize(700, 425);
picPanel.setBounds(0, 0, 700, 425);
for (int i = 0; i < 4; i++) {
for (int j = 0; j < 4; j++) {
lb[i][j] = new JLabel("", JLabel.CENTER);
lb[i][j].setFont(new Font("微软雅黑", Font.PLAIN, 16));
add(lb[i][j]);
}
}
for (... |
edcac202-b8e1-4b63-b0d6-3d794c26e5c1 | 8 | @Override
public List<Component> getAllComponents() {
Connection conn = null;
PreparedStatement st = null;
ResultSet row = null;
List<Component> res = new ArrayList<Component>();
try {
conn = OracleDAOFactory.createConnection();
st = conn.prepareStatement(GET_ALL_COMPONENTS);
row = st.executeQuery()... |
acd14324-abc5-456b-b655-020acb16bd6b | 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... |
f31ac5b8-12f8-48b8-92d8-99b69797261a | 8 | public static void allPermutationWithoutRecursion(int[] a) {
if (1 >= a.length) {
return;
}
int temp = 0;
while (true) {
int i = a.length - 2;
while (i >= 0) {
if (a[i] < a[i + 1]) {
break;
}
i--;
}
if (0 > i) {
break;
}
int j = a.length - 1;
while (j > i) {
... |
3bf223d0-a033-48bc-a70b-d7a32266f0e4 | 4 | protected void updatePopupLocation() {
final Point los = DatePickerButton.this.getLocationOnScreen();
final Rectangle gb = popup.getGraphicsConfiguration().getBounds();
final boolean ltr = DatePickerButton.this.getComponentOrientation().isLeftToRight();
final int w = DatePickerButton.this.getWidth();
final in... |
e39894cc-7a3b-4102-9726-4c4958091ce4 | 4 | @Override
public Event next() {
String itemInput = null;
try {
itemInput = br.readLine();
} catch (IOException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
if(input == null || input.equals("")){
return new UserHomeState(as, input);
}
else{
try{
as.bid(name, I... |
2cfaaef1-5391-47a8-af3d-98091ab13044 | 2 | public void addNewHero(core.Hero hero)
{
core.WorldMap wmap = core.WorldMap.getLastInstance();
if (wmap != null) {
player.addHero(hero);
castle.setHero(hero);
hero.setInCastle(castle);
//castle.lockStanding();
units.setRight(hero);
core.Point pos = wmap.getPositionOfObject(castle);
wmap.addObj... |
4c027a16-b7e8-4b2f-b6f4-8d20a73aa2c2 | 7 | private void btnGuardarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnGuardarActionPerformed
DefaultTableModel dft = (DefaultTableModel) tbPregResp.getModel();
for(int i=0; i <dft.getRowCount(); i++){
Iterator it = temaMaestro.getPreguntas().iterator();
whi... |
73ed5a35-2344-4972-86c3-3d689ce26360 | 0 | final public void forceRedraw() {
needsRedraw = true;
repaint();
} |
d6b6c761-1e36-4019-a247-ba7f1527759b | 3 | public Boolean getStat() throws Exception {
try {
for (String s: Naming.list(registry)) {
if (s.endsWith("/" +name)) {
return true;
}
}
return false;
}
catch (RemoteException e) {
Logger.getLogge... |
f57e60bc-647f-47c0-a172-9bf329df4f01 | 7 | 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://download.ora... |
6fd214a7-6338-4238-afd0-2ca18c4750cf | 5 | private void printTable() {
System.out.println("");
int row = 0;
for (String columnHead : columns) {
System.out.print(" " + columnHead + " ");
}
System.out.println("\n------------------");
for (ArrayList<Boolean> tableRow : topTable) {
System.out.print(topOfTableRow.get(... |
7f3574d4-4015-40af-ab6e-7dc960280ab7 | 4 | public boolean set_address(final String addr_) {
address.resolve(addr_, options.ipv4only > 0 ? true : false);
endpoint = address.toString();
try {
handle = ServerSocketChannel.open();
handle.configureBlocking(false);
handle.socket().setReuseAddress(t... |
7ea566a6-51d0-4cb4-807b-001d36e2d04f | 0 | public void wypozyczFilm(Long osobaId, Long filmId) {
Osoba osoba = em.find(Osoba.class, osobaId);
Film film = em.find(Film.class, filmId);
film.setWypoz(true);
osoba.getFilm().add(film);
} |
a59e592d-a69e-48a1-889b-f12414c0c58d | 0 | @XmlElement
public void setName(String name) {
this.name = name;
} |
9ecab506-f578-4a9d-aeaa-a0c205a52eb1 | 0 | @Test
public void isSingleton() {
// Singleton obj = new Singleton(); Compilation error not allowed
int count = 0;
//create the Singleton Object..
Singleton obj = Singleton.getSingletonObject();
count = count+1;
// Your Business Logic
//System.out.println("Singleton object ob... |
fe7181ee-bdd0-42ab-a11d-cc192280f48b | 0 | private boolean withdraw() {
double value = random.nextDouble();
return value < WITHDRAW_CHANCE;
} |
b86c9279-58e2-4128-af1d-79b7acae5a19 | 8 | public void avoidObstacle() {
// set status
isAvoiding = true;
// initialize variables
double delta = 0;
double fwdError = 0;
long time1=0;
long time2=0;
// get reading from top us sensor
int dist = up[Constants.topUSPollerIndex].getLatestFilteredDataPoint();
// get actual destination
doub... |
59876b87-65ff-4c40-ae94-79461ec2b8ef | 4 | public void fileCreated(int noOfFiles, String filePath, String fileName) {
// TODO: to be removed sysouts
System.out.println(noOfFiles);
System.out.println(filePath);
System.out.println(fileName);
File newFile = FileUtil.getFile(filePath, fileName);
String fileExtension = null;
if (FileUtil.isValidFil... |
f4a8b996-949a-43ca-b9d8-44eceb52db80 | 5 | public void doSpecial(String itemname) {
switch (getRoomnumber()) {// bepaal om welke kamer het gaat
case 1:
if (itemname.equals("bonekey")) {// kijk of het juiste item is gebruikt, in de juiste kamer
System.out.println("You open the chest with the BoneKey, and... nothing happened!");
} else if (itemname... |
e146feaa-36b4-4149-87f5-9467fab573ab | 5 | public void resetBank() {
outStream.createFrameVarSizeWord(53);
outStream.writeWord(5382); // bank
outStream.writeWord(playerBankSize); // number of items
for (int i = 0; i < playerBankSize; i++) {
if (bankItemsN[i] > 254) {
outStream.writeByte(255);
outStream.writeDWord_v2(bankItemsN[i]);
... |
1a8c8b8e-480d-4f3d-bec7-4eb3db194c13 | 7 | public FibersView(SingleFrameApplication app) {
super(app);
initComponents();
{
java.awt.Container pt = outerPanel.getParent();
innerPanel.setLayout(new BorderLayout(10, 10));
innerPanel.add(Blob_Panel, BorderLayout.CENTER);
Blob_Panel.setVisible(true);
//Blob_Panel.... |
1bc639cd-0d12-41d5-865b-70b981f65d93 | 5 | public void borrar(String n){
//verifico que la lista tenga 1 nodo por lo menos
if( raiz != null ){
//verifico si no es la raiz que le
//quiero dar jabon
if( raiz.nombre.equals(n)){
raiz = raiz.siguiente;
}
else{
... |
c25acc1c-5d69-4885-902d-6dd2bf529fa5 | 2 | public Grille (EnvironnementWator env){
super( env);
Border blackline = BorderFactory.createLineBorder(Color.black,1);
for(int i= 0 ; i < env.taille_envi;i++){
for(int j= 0 ; j < env.taille_envi;j++){
agent[i][j].setBorder(blackline);
}
}
pan.setBorder(blackline);
} |
8b65524d-ccc5-4323-81ab-e5b14f796fc7 | 7 | public void changeStyle(JTextPane section, String style) {
int start = 0;
int end = section.getText().length();
if (!section.getSelectedText().isEmpty()) {
start = section.getSelectionStart();
end = section.getSelectedText().length();
}
switch (style) {
case "B":
bold = (StyleConstants.isBold(att... |
d1b08a37-1c12-4313-aa5b-0039ce46a5ab | 7 | private void saveResults(String fileName) {
for (int i = 0; i < meansOfMeans.length; i++) {
meansOfMeans[i] += meansOfMeans[i] / ITERATION_PER_PARAMETERS;
}
Individual b = best.get(0);
Individual w = worst.get(0);
meansOfBests += b.getEvaluation();
meansOfWor... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.