text stringlengths 14 410k | label int32 0 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]... | 9 |
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();
... | 4 |
@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;
} | 2 |
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(... | 4 |
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 :... | 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... | 7 |
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... | 4 |
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... | 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... | 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));
... | 8 |
public String getEmail() {
return email;
} | 0 |
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));
... | 6 |
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;
} | 1 |
@Override
public boolean equals(Object obj)
{
if (obj == null)
{
return false;
}
if (getClass() != obj.getClass())
{
return false;
}
final BufferData.Key other = (BufferData.Key) obj;
... | 5 |
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... | 3 |
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);
} | 1 |
public String getMobilePer() {
return MobilePer;
} | 0 |
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... | 4 |
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;
}
} | 1 |
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");
}
... | 5 |
@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(... | 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;
} | 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... | 3 |
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... | 4 |
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 ... | 7 |
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];
// ... | 9 |
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... | 8 |
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... | 5 |
public MoveAction(Being b, Point3 p){
this.b = b;
this.p = p;
} | 0 |
public boolean areMoreVariablesWithLambdaProductions(Grammar grammar,
Set lambdaSet) {
if (getNewVariableWithLambdaProduction(grammar, lambdaSet) == null) {
return false;
}
return true;
} | 1 |
@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.... | 4 |
@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));
}
} | 1 |
* @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 ... | 7 |
private void prepareConnection() {
ClientConfig config = new DefaultClientConfig();
client = Client.create(config);
//client.addFilter(new LoggingFilter());
client.addFilter(new HTTPBasicAuthFilter(login, pass));
} | 0 |
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 (... | 9 |
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";
... | 5 |
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... | 1 |
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()... | 6 |
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... | 4 |
public Collection<String> requestConnectedUsersNicks() throws Exception {
hubComm.sendDataToHub("$GetNickList|");
String response = hubComm.getHubData();
Collection<String> NickList = new ArrayList<String>();
String[] listItems = response.split("\\|");
for (... | 3 |
public void postOrder() {
// 1 Linker Knoten , 2 Rechter Knoten, 3 Konten selber
if (left != null) {
left.postOrder();
}
if (right != null) {
right.postOrder();
}
print();
} | 2 |
public void removeNPC(int id){
for (int x = 0; x < mobs.size(); x++){
if (mobs.get(x).getID() == id){
mobs.remove(x);
}
}
} | 2 |
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... | 7 |
@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... | 8 |
public Point getCentroid(int i){
return getCell(i).getCentroid();
} | 0 |
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... | 8 |
@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... | 7 |
* 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... | 6 |
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... | 5 |
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 ... | 2 |
@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;
} | 3 |
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... | 7 |
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;
... | 5 |
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());
} | 1 |
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++) {
... | 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... | 7 |
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++) {
... | 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.... | 6 |
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;
} | 1 |
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... | 6 |
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;
... | 7 |
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 = ... | 5 |
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);
}
} | 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"... | 2 |
@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)).... | 8 |
@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())
... | 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++)
{
... | 4 |
@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... | 7 |
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... | 5 |
public void setTotal(int i) {
totalPaymentToDate=i;
} | 0 |
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... | 5 |
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());
... | 7 |
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... | 3 |
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>... | 7 |
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 (... | 6 |
@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()... | 8 |
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... | 6 |
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) {
... | 8 |
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... | 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... | 4 |
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... | 2 |
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... | 7 |
final public void forceRedraw() {
needsRedraw = true;
repaint();
} | 0 |
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... | 3 |
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... | 7 |
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(... | 5 |
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... | 4 |
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);
} | 0 |
@XmlElement
public void setName(String name) {
this.name = name;
} | 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... | 0 |
private boolean withdraw() {
double value = random.nextDouble();
return value < WITHDRAW_CHANCE;
} | 0 |
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... | 8 |
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... | 4 |
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... | 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]);
... | 5 |
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.... | 7 |
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{
... | 5 |
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);
} | 2 |
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... | 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... | 7 |
Subsets and Splits
SQL Console for giganticode/java-cmpx-v1
The query retrieves a limited number of text entries within a specific length range, providing basic filtering but minimal analytical insight.