text stringlengths 14 410k | label int32 0 9 |
|---|---|
private static void createConfigs()
{
for(int z = 0; z < fileList.size(); z++)
{
String filePath = CONFIG_FOLDER + fileList.get(z);
File conf = new File(filePath);
if(!conf.exists())
{
try
{
String[] folders = filePath.split("/");
for(int i = 0; i < folders.length - 1; i++)
{
... | 9 |
public static void UpperPlaceOfPublication(){
try {
if(conn == null || conn.isClosed()){
conn = DatabaseConnection.getConnection();
}
} catch (SQLException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
try{
conn.setAutoCommit(false);
PreparedSt... | 4 |
public String simplifyPath(String path) {
String[] paths = path.split("/+");
Deque<String> deque = new LinkedList<String>();
for (String dir : paths) {
if (dir.equals(".") || dir.equals("")) {
continue;
}
else if (dir.equals("..")) {
... | 7 |
public static boolean isPrime_v1 (int num) {
if ( num == 1) {
return true;
}
if ( num % 2 == 0 ){
return false;
}
for ( int i = 3 ; i <= Math.sqrt(num); i += 2 ) {
if ( num % i == 0 ) {
return false;
}
}
return true;
} | 4 |
public final char skipTo(char to) throws JSONException {
char c;
try {
int startIndex = this.index;
reader.mark(Integer.MAX_VALUE);
do {
c = next();
if (c == 0) {
reader.reset();
this.index = star... | 3 |
public void keyPressed(KeyEvent k) {
if (k.getKeyCode() == KeyEvent.VK_RIGHT) {
myPaddle.moveRight();
padq.offer(new Position(myPaddle.getPosition()));
} else if (k.getKeyCode() == KeyEvent.VK_LEFT) {
myPaddle.moveLeft();
padq.offer(new Position(myPaddle.getPosition()));
}
} | 2 |
public void run() {
// get line and buffer from ThreadLocals
SourceDataLine line = (SourceDataLine)localLine.get();
byte[] buffer = (byte[])localBuffer.get();
if (line == null || buffer == null) {
// the line is unavailable
return;
... | 7 |
@Override
public Object evaluate(Context context) {
Iterator<Term> i = terms.iterator();
Object value = i.next().operand.evaluate(context);
while (i.hasNext()){
Term next = i.next();
switch (next.operator){
case AND: value = Operations.and(value, next.operand.evaluate(context)); break;
case ... | 4 |
public static void main(String[] args) throws UnknownHostException
{
//Initialize Logger
Logger.initialize("thralld_server started at:"+(new Date()).toString(),Level.SEVERE);
System.out.println("thralld_server started at:"+(new Date()).toString());
//Setup available commands
setupAvailableCommands();
... | 4 |
@Override
public void trainOnInstanceImpl(Instance inst) {
this.iterationControl++;
double costNow;
if (this.iterationControl <= this.numInstancesInitOption.getValue()) {
costNow = 0;
} else {
costNow = (this.costLabeling - this.numInstancesInitOption.getVa... | 7 |
public void output() {
ListElement current = head;
while (current != tail.next) {
System.out.print(Integer.toString(current.value) + " ");
current = current.next;
}
System.out.println();
} | 1 |
@Override
public void saveMarks(List<Student> students,int courseId) throws SQLException {
Connection connect = null;
PreparedStatement statement = null;
try {
Class.forName(Params.bundle.getString("urlDriver"));
connect = DriverManager.getConnection(Params.bundle.get... | 7 |
final int method1859(int i, long l) {
if (i != 71)
method1859(41, -7L);
if (aLong6161 < aLong6160) {
aLong6162 += aLong6160 + -aLong6161;
aLong6161 += -aLong6161 + aLong6160;
aLong6160 += l;
return 1;
}
int i_3_ = 0;
do {
i_3_++;
aLong6160 += l;
} while (i_3_ < 10 && aLong6161 >... | 5 |
public void run()
{ try
{ String prevChecksum = "";
while(true)
{ String currentChecksum = getFileChecksum();
if(currentChecksum.equals(prevChecksum))
{ Thread.sleep(1000);
continue;
}
BufferedReader fileReader = new BufferedReader(new FileReader(file));
String loop;
pw.println(Con... | 5 |
public String reactionToString(Reaction R){
String str = "";
for(int i=0; i<R.getReactants().length; i++){
str = str+R.getMolReactants().get(i).toStringf()+" ";
if(i!=R.getReactants().length-1){
str = str+"+ ";
}
}
str=str+"---> ";
for(int i=0; i<R.getProducts().l... | 4 |
static void checkDependencyReferencesPresent(List<AccessibleObject> objects, Map<String, AccessibleObject> props) {
// iterate overall properties marked by @Property
for(int i = 0; i < objects.size(); i++) {
// get the Property annotation
AccessibleObject ao = objects.get(i) ;
P... | 7 |
protected void processRequest(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
try {
String alias = request.getRequestURI().replace(request.getContextPath() + "/", "");
ISimpleDatasetConfiguration dataset = Dataset... | 7 |
public boolean isRowFiltered(Row row) {
if (mRowFilter != null) {
return mRowFilter.isRowFiltered(row);
}
return false;
} | 1 |
private static void record(Record record, ItemStack stack, int score) {
ItemMeta meta = stack.getItemMeta();
List<String> lore = meta.getLore();
boolean set = false;
final String loreLine = record.getLoreLine();
for (int i = 0; i < lore.size(); i++) {
String string = ... | 4 |
@SuppressWarnings("unchecked")
public PairList<Integer, Double> getValueSortedBucket(int material)
{
material = (material & RawMaterial.MATERIAL_MASK) >> 8;
final int numMaterials = Material.values().length;
if ((material < 0) || (material >= numMaterials))
return null;
if (buckets == null)
{
... | 7 |
@Override
public void stateChanged(ChangeEvent event) {
if (event.getSource().equals(startDatePicker.getModel())) {
eventStart.set( startDatePicker.getModel().getYear(),
startDatePicker.getModel().getMonth(),
startDatePicker.getModel().getDay());
if (eventStart.after(eventEnd)) {
eventE... | 4 |
private static Method getMethod(Object o, Object[] args, String methodName, Class<?>[] argsArray){
Method method = null;
try {
method = o.getClass().getMethod(methodName, argsArray);
} catch (NoSuchMethodException e) {
try{
method = o.getClass().getDeclaredMethod(methodName, argsArray);
}catch (NoSuc... | 6 |
public void ToolsHouseInputValidated(){
try{
this.SetInput(ReadInput.readLine().trim().toUpperCase());
}
catch(IOException e){
SetValidatedInput(false);
return;
}
if(this.Input != EXIT){
try{
int i = Integer.parseInt(Input);
if(i == THIRD || i == SECOND || i == FIRST)
SetValidatedInpu... | 6 |
public WrapperMoney sellItemBucket(int idx, int count, WrapperMoney in) throws Exception {
isValidItem(idx);
Bucket b = cache[idx];
int diff = b.value * count - in.sum();
if (diff < 0 ) {
return null;
}
if ( diff ==0 ){
return new WrapperMoney(Arrays.asList(Money.zero));
}
return getChange(dif... | 2 |
public ArrayList<BooksDTO> selectBook(BooksDTO booksDTO, int option,
String keyword) {
conn = JDBCUtil.getInstance().getConnection();
// 결과 마인드맵 리스트를 담을 객체
ArrayList<BooksDTO> list = new ArrayList<BooksDTO>();
try {
System.out.println("나와랏");
if (option == StatusUtil.bookOptionRegistNumber) {
pst... | 8 |
@Override
public void run() {
String status = Thread.currentThread().getName();
if(status.equals(Message.send_status)){
this.serialize_send();
}
else if(status.equals(Message.receive_status)){
try {
this.serialize_receive();
} catch (ClassNotFoundException e) {
e.printStackTrace();
} catch ... | 7 |
public static <T> Query<T> flatternAncestors(T child, Selector<T, T> selector)
{
return new Query<T>(new AncestorIterable<T>(child, selector ));
} | 0 |
public void sendCommand(String sql, String date, String task, String subtask){
try{
// Execute SQL query
PreparedStatement ps = connection.prepareStatement(sql);
ps.setString(1,date);
ps.setString(2,task);
if (subtask != ""){
ps.setStri... | 2 |
public CommingRequesFileTransferHandler(ServerSocket socket, String name) {
serverSocket = socket;
fileName = name;
receiveListInBytes = new ArrayList<byte[]>();
} | 0 |
public static void main(String[] args)
{
//process the input first
//if the input is from the console
Scanner in = null;
if (args.length == 0)
{
in = new Scanner(System.in);
}
else if (args.length == 1)
{
File file = new File(args[0]);
if (!file.exists() || !file.canRead()) {
System.err.pr... | 8 |
@Override
public ParseResult<T, List<A>> parse(LList<T> tokens) {
ParseResult<T, List<A>> r = this.parser.parse(tokens);
if(!r.isSuccess()) {
assert false; // many0 should *always* succeed
}
// have to match parser at least one time
if(r.getValue().size() >= 1) {
return r;
}
return ParseResult.fail... | 2 |
@SuppressWarnings("unchecked")
public <P> P as(Class<P> proxyType) {
final boolean isMap = (object instanceof Map);
final InvocationHandler handler = new InvocationHandler() {
@Override
public Object invoke(Object proxy, Method method, Object[] args)
throws Throwable {
String name = method.getName()... | 9 |
public static void main(String[] args) throws IOException {
while (true) {
String[] input = READER.readLine().split(" ");
int height = Integer.parseInt(input[0]);
int width = Integer.parseInt(input[1]);
if (height == 0 && width == 0) {
return;
}
for (int i = 0; i < height; ++i) {
char[] line... | 9 |
public String formatLiteralVariableString(final String str) throws InvalidArgumentException {
if (null == str || "".equals(str.trim())) throw new InvalidArgumentException(
ErrorMessage.LITERAL_VARIABLE_DEFINITION_NOT_FOUND);
if (str.charAt(0) == DomConst.Literal.LITERAL_VARIABLE_PREFIX
|| str.charAt(0) == D... | 7 |
private int getNextCellIndex () {
int selectedCellIndex = -1;
double minF = Double.MAX_VALUE;
for (int i = 0; i < openedCells.size(); i++) {
Point currentOpenCell = openedCells.get(i);
double localF = 0;
if (field[currentOpenCell.x][currentOpenCell.y] instan... | 3 |
public static void printClockLn(String string, int l) {
if (check(l)) {
toTerminal(getTime() + " " + string + "\n", l);
}
} | 1 |
private int objectState( char next ) {
if ( next == ',' ) {
buffer.pop();
next = nextValue();
}
switch (next) {
case END_OBJECT: {
popState();
return returnValue( END_OBJECT, state );
}
case '"': {
... | 4 |
protected void draw_symbol(Graphics2D g, float xpos, float ypos, Object symbol, int size1) {
if (symbol == null)
return;
int size2 = size1 / 2;
g.setStroke(symbolStroke);
if (symbol instanceof Ellipse2D.Float) {
Ellipse2D.Float circle = (Ellipse2D.Float) symbol;
circle.setFrame(xpos - size2, ypos - ... | 9 |
public char[] GetSuffix(int len)
{
char[] ret = new char[len];
if ((bufpos + 1) >= len)
System.arraycopy(buffer, bufpos - len + 1, ret, 0, len);
else
{
System.arraycopy(buffer, bufsize - (len - bufpos - 1), ret, 0,
len - bufpos - 1);... | 1 |
public static void addArticlesIntoDatabase(List<Article> alist) {
StringBuffer sb = new StringBuffer("INSERT INTO soc.articles VALUES");
StringBuffer sb2 = new StringBuffer("INSERT INTO soc.coauthors VALUES");
try {
if (conn == null || conn.isClosed()) {
init();
}
if (statement == null || statement.i... | 6 |
public boolean stem() {
int v_1;
int v_2;
int v_3;
int v_4;
// (, line 133
// do, line 134
v_1 = cursor;
lab0: do {
// call prelude, line 134
if... | 8 |
private URL addDownloadKey(URL url, String downloadHost, String downloadKey, String clientId) {
if (downloadHost != null && !downloadHost.isEmpty()) {
try {
url = new URI(url.getProtocol(), url.getUserInfo(), downloadHost, url.getPort(), url.getPath(), url.getQuery(), null).toURL();
... | 7 |
public static void Adjust(int[] a, int i, int n)
{
int j = 0;
int temp = 0;
temp = a[i];
j = 2 * i + 1;
while(j <= n-1)
{
if(j < n-1 && a[j] < a[j+1])
j++;
if(temp >= a[j])
break;
a[(j-1)/2] = a[j];
j = 2 * j + 1;
}
a[(j-1)/2] = temp;
} | 4 |
private void repondreRequete (HttpServletRequest requete, HttpServletResponse reponse, Map<String, Action> routes)
throws ServletException, IOException {
requete.setCharacterEncoding("utf-8");
reponse.setCharacterEncoding("utf-8");
/*
for (Object k : requete.getParameterMap()... | 8 |
public static final Color checkAlphaColour(int red, int green, int blue, int alpha)
{
if (red < 0)
red = 0;
else if (red > 255)
red = 255;
if (green < 0)
green = 0;
else if (green > 255)
green = 255;
if (blue < 0)
blue = 0;
else if (blue > 255)
blue = 255;
... | 8 |
private static int getValueOf(TokenType type, String s) {
switch (type){
case DIGIT:
case NTY:
case TEEN:
int toReturn = type.getValue(s);
assert (toReturn >= 0) : "No value found for token type " + type;
return toReturn;
... | 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://down... | 6 |
@Override
public Auction bid(String username, int itemId) {
// searches.get(itemId));
Auction a = searches.get(itemId);
if(a != null){
a.setCurrentBid(a.getCurrentBid()+1);
a.setNumerOfBidsRemaining(a.getNumberOfBidsRemaining()-1);
a.setOwner(username);
// return a;
}
System.out.println("The... | 1 |
public Format setOutputFormat(Format output) {
if (output == null || matches(output, outputFormats) == null)
return null;
RGBFormat incoming = (RGBFormat) output;
Dimension size = incoming.getSize();
int maxDataLength = incoming.getMaxDataLength();
int lineStride = ... | 6 |
@Override
public void run() {
for(int i = 0; i < gots.size(); i++){
if(!gots.get(i).sendInit(seed, nbrOfPlayers, i)){
System.out.println("SENDING INIT FAILED");
}
}
long desiredSleep = Constants.GAME_SPEED;
long diff = 0;
while(true) {
Byte[] commands = new Byte[nbrOfPlayers];
for(int i = 0; ... | 6 |
@Override
public boolean equals(Object obj) {
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
final DataMessage other = (DataMessage) obj;
if (this.sequenceNumber != other.sequenceNumber ||
... | 4 |
@Override
public void initChannel(SocketChannel ch) throws Exception {
ChannelPipeline p = ch.pipeline();
p.addLast("httpcodec", new HttpServerCodec(8192, 8192 * 2, maxChunkSize));
if (blackList != null && blackList.length > 0) {
p.addLast("filter", new InboundFilterHandler(bla... | 3 |
@Test
public void transferInstructionOpcodeTest() { //To test instruction is not created with illegal opcode for format
try {
instr = new TransferInstr(Opcode.ADD, 0, 0);
}
catch (IllegalStateException e) {
System.out.println(e.getMessage());
}
assertNull(instr);//instr should be null if creation has ... | 1 |
public boolean estEnAttente(){
if(this.etat == EN_ATTENTE){
return true ;
}
else {
return false ;
}
} | 1 |
public double distance(double x, double y) {
if (x >= left && x <= right) {
if (y >= top) {
if (y <= bottom) {
return 0;
}
else {
return y - bottom;
}
}
else {
return top - y;
}
}
else if (y >= top && y <= bottom) {
if (x < left) {
return left - x;
}
else {
... | 9 |
public void keyPressed(KeyEvent e){
int keyCode = e.getKeyCode();
//if you press up, move up
if(keyCode == KeyEvent.VK_UP){
//if you touch a "w" or wall, the move does not occur
if(!m.getMap(p.getTileX(), p.getTileY() - 1).equals("w") )
p.move(0, -1);
}
//if you press down, move down
if(... | 8 |
@Override
public void mouseDragged(MouseEvent e) {
if (e.getSource().equals(this.pnLeftImage) ||
e.getSource().equals(this.pnRightImage)) {
JPanelPicture currentPanel = null;
Point currentAnchor = null;
JSpinner currentSpinerX = null;
JSpinner currentSpinerY = null;
if (e.getSource().equals(this.... | 9 |
@Override
public int hashCode() {
int result = rWord != null ? rWord.hashCode() : 0;
result = 31 * result + (eWord != null ? eWord.hashCode() : 0);
return result;
} | 2 |
private final String getLabel(final Label label) {
String name = (String) labelNames.get(label);
if (name == null) {
name = Integer.toString(labelNames.size());
labelNames.put(label, name);
}
return name;
} | 1 |
private void tblListagemFuncionarioMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_tblListagemFuncionarioMouseClicked
Object valor = tblListagemFuncionario.getValueAt( tblListagemFuncionario.getSelectedRow(), 0);
Funcionario funci = null;
try {
funci = dao.Abrir((int)v... | 3 |
private boolean jj_3R_57() {
Token xsp;
xsp = jj_scanpos;
if (jj_3_54()) jj_scanpos = xsp;
if (jj_3R_87()) return true;
return false;
} | 2 |
public CantroserverView(SingleFrameApplication app) {
super(app);
initComponents();
owner = (CantroserverApp)app;
jList1.addListSelectionListener(this);
// status bar initialization - message timeout, idle icon and busy animation, etc
ResourceMap resourceMap = getRes... | 7 |
@Override
public void packetIncoming(Packet packet) {
if(packet.channel.equals(References.CHANNEL_PLAYER_DC)){
this.playerDC(packet);
}else if(packet.channel.equals(References.CHANNEL_JOIN)){
this.join(packet);
}else if(packet.channel.equals(References.CHANNEL_STARTGAME)) {
this.startGame(packet);
}el... | 5 |
@EventHandler
public void WitchResistance(EntityDamageByEntityEvent event) {
Entity e = event.getEntity();
Entity damager = event.getDamager();
String world = e.getWorld().getName();
boolean dodged = false;
Random random = new Random();
double randomChance = plugin.getWitchConfig().getDouble("Witch.Resista... | 6 |
public static String unescape(String s) {
int len = s.length();
StringBuffer b = new StringBuffer();
for (int i = 0; i < len; ++i) {
char c = s.charAt(i);
if (c == '+') {
c = ' ';
} else if (c == '%' && i + 2 < len) {
int d = JS... | 6 |
protected AttributeClassObserver newNumericClassObserver() {
switch (this.numericEstimatorOption.getChosenIndex()) {
case 0:
return new GaussianNumericAttributeClassObserver(10);
case 1:
return new GaussianNumericAttributeClassObserver(100);
ca... | 9 |
public static void left() {
if(GraphicsMain.viewX - 100 > 0) {
viewX -= 1;
}
} | 1 |
@Override
public boolean keyDown(int keycode) {
switch(keycode) {
case Keys.W:
direction.y = speed;
animationTime = 0;
break;
case Keys.A:
direction.x = -speed;
animationTime = 0;
break;
case Keys.S:
direction.y = -speed;
animationTime = 0;
break;
case Keys.D:
direction.x = spee... | 4 |
public void canvasMouseReleased(MouseEvent e)
{
actObjectleft = null;
actObjectright = null;
if(mytabbedpane.getSelectedIndex()==0)
{
for(GeometricObject go : geomListleft)
{
if(go.isInside(e.getX(), e.getY()) != -1)
{
actObjectleft = go;
if(isActive == fals... | 9 |
private void listFiles() {
FTPClient client = new FTPClient();
try {
client.connect("ftp.site.com");
client.login("username", "password");
FTPFile[] files = client.listFiles();
for (FTPFile ftpFile : files) {
if (ftpFile.getType() == FTPFil... | 4 |
public static final boolean contentEquals( Object c1, Object c2 ) {
if( c1 == null && c2 == null ) return true;
if( c1 == null || c2 == null ) return false;
if( c1 instanceof byte[] && c2 instanceof byte[] ) {
return equals( (byte[])c1, (byte[])c2 );
}
return c1.equals(c2);
} | 6 |
private void getAllInterface(Class<?> clazz, Set<String> interfacesSet) {
Class<?>[] interfaces = clazz.getInterfaces();
Class<?> c = clazz;
while (null != c) {
interfacesSet.add(c.getName());
c = c.getSuperclass();
}
for (Class<?> inte : interfaces) {
interfacesSet.add(inte.getName());
}
if (!cl... | 7 |
public boolean isBetter(Object other) {
double otherValue = ((Quantity) other).convertTo(this.unit);
return this.value > otherValue;
} | 0 |
public static int fillTableVerbose(int rows, int cols,int colStart,int colEnd){
int cri=1;//current row index. begin calc at table [1][1]
int cci=1;//current col. index
int up,left,caddy,bestChoice=0,val=0;//the ones to look at and the one to choose.
char let1,let2;//left and top seq letters. gene left genome t... | 7 |
public void run()
{
final double S = 1; // Units to move
try
{
GameObject ball = pongModel.getBall();
GameObject bats[] = pongModel.getBats();
while ( true )
{
double x = ball.getX(); double y = ball.getY();
// Deal with possible edge of board hit
... | 8 |
public void moveJump(Jump jump) {
if (this.jump != null)
throw new AssertError("overriding with moveJump()");
this.jump = jump;
if (jump != null) {
jump.prev.jump = null;
jump.prev = this;
}
} | 2 |
public static void main(String[] args) {
class Point {
double x;
double y;
}
Scanner s = new Scanner(System.in);
String input;
Point point1 = new Point();
Point point2 = new Point();
Point point3 = new Point();
... | 9 |
public void reorderList(ListNode head) {
if(head == null || head.next ==null) return;
ListNode curr1 = head;
int count = 0;
while(curr1 != null)
{
curr1=curr1.next;
count ++;
}
//split after count/2
ListNode second = null;
curr1 = head;
int i = 1... | 9 |
private void connect_db(){
if(!secondary)
db = new Database("jdbc:postgresql://localhost/vsy","vsy","vsy");
else
db = new Database("jdbc:postgresql://localhost/vsy2","vsy2","vsy2");
} | 1 |
public void setFeature (String name, boolean value)
throws SAXNotRecognizedException, SAXNotSupportedException
{
if (name.equals(NAMESPACES)) {
checkNotParsing("feature", name);
namespaces = value;
if (!namespaces && !prefixes) {
prefixes = true;
}
} else if (name.equals(NAMESPACE_PREFIXES)... | 7 |
protected void addImage(String relURL) {
this.imageURL = relURL;
this.imageConstraints = new GridBagConstraints();
imageConstraints.gridx = 1;
imageConstraints.gridy = 0;
imageConstraints.gridheight = 4;
this.imageIndex = 0;
try {
imageIcon = new ImageIcon(ImageIO.read(getClas... | 3 |
public void drawTo(PPMEC PPM) {
int c = (int) (xRatio * PPM.getWidth());
int r = (int) (yRatio * PPM.getHeight());
int hLengthB = (int) (baseR * PPM.getWidth() / 2);
double angleR = Math.toRadians(ANGLE);
double angleHR = Math.toRadians(ANGLEH);
double h = (int) (Math.tan(angleR) * hLengthB);
PPM.setPixel... | 3 |
@Override
public boolean delete(Object item) {
conn = new SQLconnect().getConnection();
String sqlcommand = "UPDATE `Timeline_Database`.`Timenodes` SET `display`='false' WHERE `id`='%s';";
if(item instanceof Timenode)
{
Timenode newitem = new Timenode();
newitem = (Timenode)item;
try {
String s... | 2 |
public static List<String> GetMissingDependencies(File f, String delimeter) throws IOException{
HashMap<Integer,Set<String>> columnData = new HashMap<Integer,Set<String>>();
List<String> missingValues = new ArrayList<String>();
FileReader file_reader = new FileReader(f);
BufferedReader reader = new BufferedR... | 6 |
float calcSurfacePoint(float cutoff, float valueA, float valueB, Point3f surfacePoint) {
float fraction;
if (isJvxl && jvxlEdgeDataCount > 0) {
fraction = jvxlGetNextFraction(edgeFractionBase, edgeFractionRange, 0.5f);
thisValue = fraction;
}
else {
float diff = valueB - valueA;
fraction = (cutoff -... | 8 |
private void createNewUser(String username, String newUserName, String newUserPid, String newUserPassword, boolean admin, String configurationArea, Collection<DataAndATGUsageInformation> data)
throws ConfigurationTaskException, RequestException {
if(isAdmin(username)) {
// Es werden 4 Fälle betrachtet
// Fa... | 7 |
public static void testValidity(Object o) throws JSONException {
if (o != null) {
if (o instanceof Double) {
if (((Double) o).isInfinite() || ((Double) o).isNaN()) {
throw new JSONException(
"JSON does not allow non-finite numbers.");
... | 7 |
public void displayLogs(ArrayList<TimeStampedMessage> sortedLogs) {
System.out.println("LOG FILE WITH ORDER AND CONCURRENT FLAG");
if (sortedLogs.size() == 0) {
System.out.println("LOGFILE IS EMPTY");
return;
}
System.out.println(sortedLogs.get(0).toString() + " ConCurrent:"
+ sortedLogs.get(0).getCo... | 3 |
public Timer(int granularity) {
this.granularity=granularity;
} | 0 |
@Override
public Double draw(String id, Double out) {
if(id == null || "".equals(id.trim()) || out < 0) {
return -1.0;
}
for(Account a : accounts) {
if(id.equals(a.getId())) {
if(a.getBalance() < 0 || a.getBalance() < out) {
return ... | 7 |
public static ListNode merge(ListNode l1, ListNode l2) {
/* If any of the two lists is empty, return the other one */
if (l1 == null) {
return l2;
}
if (l2 == null) {
return l1;
}
/*
* Keep two pointers:
* (1) results (HEAD) of merged list,
* (2) tail (TAIL) of merged list
*/
... | 8 |
public boolean isPalindrome2(String s) {
if (s == null || s.length() == 0) {
return true;
}
int front = 0;
int end = s.length() - 1;
while (front < end) {
while (front < s.length() && !isValid(s.charAt(front))) {
front++;
}
// for empty string
if (front == s.length()) {
return true;
... | 9 |
protected void animateModel() {
_rootMatrix.getIdentityMatrix();
if (_xRotationAngle != 0) {
tempMtx.getArbitraryAxisRotationMatrix(_xRotationAngle, 1, 0, 0);
// tempMtx.getXAxisRotationMatrix(_xRotationAngle);
_rootMatrix.multiply(tempMtx);
}
if (_yRotationAngle != 0) {
tempMtx.getArbitraryAxisRotat... | 6 |
public FieldDescriptor findExtensionByName(String name) {
if (name.indexOf('.') != -1) {
return null;
}
if (getPackage().length() > 0) {
name = getPackage() + '.' + name;
}
final GenericDescriptor result = pool.findSymbol(name);
if (result != null && result instanceof... | 5 |
public void rebond(Projectiles projectile, char orientation) {
if (orientation == 'y') {
projectile.getVitesse().setY(-projectile.getVitesse().getY() * projectile.getFacRebond());
projectile.getVitesse().setX(projectile.getVitesse().getX() * projectile.getFacRebond());
if (projectile.getVitesse().getY()... | 6 |
public MemoryLeak() {
elements = new Object[DEFAULT_INITIAL_CAPACITY];
} | 0 |
public int genererNumeroClient(){
System.out.println("ModeleLocations::genererNumeroClient()") ;
int numMax = 0 ;
for(Client client : this.clients){
if(client.getNumero() > numMax){
numMax = client.getNumero() ;
}
}
return numMax + 1 ;
} | 2 |
public void update(long deltaMs) {
Iterator<IntBuffer> it = sources.iterator();
while(it.hasNext()) {
IntBuffer source = it.next();
if(AL10.alGetSourcei(source.get(0), AL10.AL_SOURCE_STATE) == AL10.AL_STOPPED) {
AL10.alDeleteSources(source.get(0));
... | 2 |
static public void start() {
CallableStatement callableStatement = null;
Connection con = null;
Connection mscon = null;
ArrayList<StrongmailMailing> smlist = new ArrayList<StrongmailMailing>();
try {
Class.forName("org.postgresql.Driver");
String jdbcF... | 7 |
public Object clone() {
try {
SlotSet other = (SlotSet) super.clone();
if (count > 0) {
other.locals = new LocalInfo[count];
System.arraycopy(locals, 0, other.locals, 0, count);
}
return other;
} catch (CloneNotSupportedException ex) {
throw new alterrs.jode.AssertError("Clone?");
}
} | 2 |
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.