text stringlengths 14 410k | label int32 0 9 |
|---|---|
public void addMessage(String message) {
boolean scrollDown = isChatAtBottom();
if (!isFirst)
textArea.append("\n" + message);
else {
textArea.append(message);
isFirst = false;
}
if (scrollDown) {
moveChat2Bottom();
}
} | 2 |
@Override
public void startListening() {
if (this.state == ServerState.Running) return;
this.state = ServerState.Running;
this.serverRunner = new Thread(new Runnable() {
@Override
public void run() {
while (state == ServerState.Runnin... | 4 |
public void makeDeclaration(Set done) {
if (constant != null) {
constant.makeDeclaration(done);
constant = constant.simplify();
}
} | 1 |
private synchronized ByteBuffer unwrap() throws SSLException {
int rem;
do {
rem = inData.remaining();
engineResult = sslEngine.unwrap( inCrypt, inData );
engineStatus = engineResult.getStatus();
} while ( engineStatus == SSLEngineResult.Status.OK && ( rem != inData.remaining() || engineResult.getHandsha... | 3 |
public int availableMissile(){
mCurTime=System.nanoTime();
if(missileTime<=1500000000l){
if(mSparks){
if(index==3){
temp = User.getMissile1Pos();
rot.rotX(Math.PI/2);
temp.mul(rot);
new WrapParticles(75,20,1,init,last,10000,temp,sceneBG).run();
}
if(index==4){
temp = User.... | 7 |
private void init(Stage primaryStage) {
Group root = new Group();
Scene scene = new Scene(root);
primaryStage.setResizable(true);
primaryStage.setScene(scene);
primaryStage.setTitle("Draw App");
final MainWindow mainWindow = new MainWindow();
root.getChildren().add(mainWindow);
Reader reader;
if (T... | 3 |
private int determineCurrentFrame() {
boolean animationJustCompleted = false;
if (animinationStartTime == -1)
animinationStartTime = System.nanoTime() / 1000000;
long currentTime = System.nanoTime() / 1000000;
// Check if the animation has exceeded its specified overall dur... | 5 |
public ValueRepresentation evaluateVariable(XPathContext context) throws XPathException {
Controller controller = context.getController();
Bindery b = controller.getBindery();
boolean wasSupplied;
try {
wasSupplied = b.useGlobalParameter(
getVariableQName(... | 9 |
public DistanceBall(Ball b, double referencePoint) {
double xVelocity = b.getXVelocity();
double yVelocity = b.getYVelocity();
double centerX = b.getCenterX();
double centerY = b.getCenterY();
double radius = b.getRadius();
this.numberMoves = Math.abs((int) Math.floor(distance(referencePoint, xVelocity, cen... | 2 |
public static Language createNew(Connection con, String id, String name, String persPron)
{
Language lang = null;
try
{
PreparedStatement ps = con.prepareStatement(
"INSERT INTO " + tableInfo.tableName
+ " VALUES (?, ?, ?)",
Statement.RETURN_GENERATED_KEYS);
ps.setString(1, id);
ps.setStr... | 2 |
public ReflectionCache(Class<?> serviceInterface) {
if (!serviceInterface.isInterface()) {
throw new ClassFormatError(String.format("Class '%s' is not an interface!", serviceInterface.getName()));
}
Method[] methods = serviceInterface.getMethods();
methodIdToName = new HashM... | 8 |
public int translate(int va, int size, boolean inst, boolean priv, boolean read) {
int paL1, entryL1, typeL1, pa;
boolean validAlign;
if (isFault()) {
//フォルト状態がクリアされず残っている
throw new IllegalStateException("Fault status not cleared.");
}
//TODO: アドレス以外の条件が... | 9 |
@Override
public void first (String host, String db_name, String user, String pw) {
try {
this.host = host;
this.db_name = db_name;
this.user = user;
this.pw = pw;
connect();
} catch (SQLException ex) {
... | 1 |
public void playerPlays(Card card) {
if (card == null) {
/* 1) den exei na paiksei kai dn exei traviksei karta
* 2) den exei na paiksei kai exei traviksei karta
* 3) katw einai 7 ari kai den exei 7 na paiksei = pairnei 2
* 4) katw einai 7 ari alla einai apo ton... | 9 |
public List getIPEntriesDebug(String s) {
List<IPEntry> ret = new ArrayList<IPEntry>();
long endOffset = ipEnd + 4;
for (long offset = ipBegin + 4; offset <= endOffset; offset += IP_RECORD_LENGTH) {
// 读取结束IP偏移
long temp = readLong3(offset);
// 如果temp不等于-1,读取IP的地点信息
if (temp != -1) {
IPLocation ip... | 4 |
@Override
public Status live() {
super.live();
// Insects will only act every ANTACTIONDELAY milliseconds
if (this.getTimeManager().getCurrentDate().getTime() - this.lastTime < Consts.ANTACTIONDELAY
&& this.lastTime != 0) {
return null;
}
InsectBo... | 9 |
public boolean isValid() {
if (this.port == null || this.port.isEmpty()) {
return false;
}
if (this.ip == null || this.ip.isEmpty()) {
return false;
}
return true;
} | 4 |
public int[] PlusOne(int[] digits){
int carry =1,sum=0;
int[] result = new int[digits.length];
for(int i = digits.length -1; i>=0; i--){
sum = carry+digits[i];
carry = sum/10;
result[i] = sum%10;
}
if(carry == 1){
int[] plusone = new int[digits.length+1];
plusone[0] = carry; int i = 1... | 3 |
double acceptanceProbability(int energy, int newEnergy, double temperature){
if(newEnergy < energy) return 1;
return Math.exp((energy - newEnergy) / temperature);
} | 1 |
private static void add(Map<Class<?>, Class<?>> forward,
Map<Class<?>, Class<?>> backward, Class<?> key, Class<?> value) {
forward.put(key, value);
backward.put(value, key);
} | 6 |
String commandLineStr(boolean splitLines) {
StringBuilder argsList = new StringBuilder();
argsList.append("SnpEff " + command + " ");
int size = argsList.length();
for (String arg : args) {
argsList.append(arg);
size += arg.length();
if (splitLines && (size > COMMAND_LINE_WIDTH)) {
argsList.append... | 3 |
private static void parseFiles(final Map<String, String> args, final CommandLineArguments result)
throws ParseException
{
if (args.containsKey("binary"))
{
result.binary = Boolean.parseBoolean(args.get("binary"));
}
if (args.containsKey("dir"))
{
final File directory = new File(args.get("dir"));
... | 7 |
public boolean hasCycles() {
// check for cycles
boolean[] bDone = new boolean[m_nNodes];
for (int iNode = 0; iNode < m_nNodes; iNode++) {
// find a node for which all parents are 'done'
boolean bFound = false;
for (int iNode2 = 0; !bFound && iNode2 < m_nNodes; iNode2++) {
if (!bDone[iNode2]... | 9 |
public void searchForSMClasses(Class clazzLocation, Field[] lof){
//System.out.println("NOW LOOKING AT:" + clazz.getName());
JSONObject jObj = new JSONObject();
for(Field f: lof){
//Get generic type.
Class genericType = getFieldGenericType(f);
//If SM objec... | 7 |
public byte[] toByteArray(){
try{
ByteArrayOutputStream bos = new ByteArrayOutputStream();
ObjectOutput out = null;
out = new ObjectOutputStream(bos);
out.writeObject(this);
byte[] yourBytes = bos.toByteArray();
try{
bos.close();
out.close();
}catch(Exception e){System.out.println("A M... | 2 |
@SuppressWarnings({"unchecked"})
protected void doEncodeAll(FacesContext ctx) throws IOException {
String strValue = null;
try {
if (getSubject() != null) {
// Get the principal to print out
Object principal;
if (type == null) {
... | 8 |
static double[][] minor(double[][] A, int i, int j){
double[][] minor = new double[A.length-1][A.length-1];
int n = 0, m = 0;
for(int k = 0; k < A.length; k++){
if(k == i)
continue;
for(int l = 0; l < A.length; l++){
if(l == j)
continue;
minor[n][m] = A[k][l];
m++;
}
n++;
m = ... | 4 |
public ImprovedStack reverse() {
ImprovedStackImpl output = new ImprovedStackImpl();
output.list.array = new Object[size()];
for (int i = size() - 1; i >= 0; i--) {
output.push(list.get(i).getReturnValue());
System.out.println(list.get(i).getReturnValue());
}
return output;
} | 1 |
private void initStreamOrSource() throws FileNotFoundException {
if (dataSourceStream != null) {
final Reader r = new InputStreamReader(dataSourceStream);
setDataSourceReader(r);
addToCloseReaderList(r);
} else if (dataSource != null) {
final Reader r = ne... | 2 |
public void delete(String query){
try {
this.statement.executeUpdate(query);
} catch (SQLException ex) {
Logger.getLogger(DatabaseConnection.class.getName()).log(Level.SEVERE, null, ex);
}
} | 1 |
private ParameterSweep readParameter(Configuration configFile,
String paramName, String paramSweep, String paramType,
String paramValue, int paramNum) {
ParameterSweep sweep = null;
if (paramSweep.equalsIgnoreCase("list")) {
List<Object> values = configFile.getList(paramValue);
sweep = new ListSweep<>... | 9 |
public void update(GameTimer gameTime)
{
// Make a copy of the master screen list, to avoid confusion if
// the process of updating one screen adds or removes others.
_ScreensToUpdate.clear();
for (GameScreen screen : _Screens)
{
_ScreensToUpdate.add(screen);
}
boolean otherScreenHasFocus = false;
... | 6 |
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
ZapposSearchResponse other = (ZapposSearchResponse) obj;
if (currentResultCount != ot... | 9 |
public float readFloat() throws IOException {
int code = readNextCode();
float result;
switch (code) {
case Codes.FLOAT:
result = is.readRawFloat();
break;
default: {
Object o = read(code);
if (o instanceof F... | 2 |
@Override
public void componentMoved(ComponentEvent e) {} | 0 |
private void commit() {
LinkedList<Vec2> pointsList = new LinkedList<>();
for (Curve curve : draftform.getCurves()) {
for (draftform.Vec2 dVec : curve.linearize(curve.recommendedSubdivisions()))
pointsList.add(new Vec2(dVec.getX(), dVec.getY()));
pointsList.removeLast();
}
Vec2[] points = new Vec... | 5 |
public void togglePaused(){
paused = !paused;
if (paused) {
pauseObjects();
numAsteroids = asteroids.size();
}
} | 1 |
@Override
public void keyReleased(KeyEvent e) {} | 0 |
protected static Object getParamArg(Class cl)
{
if (! cl.isPrimitive())
return null;
else if (boolean.class.equals(cl))
return Boolean.FALSE;
else if (byte.class.equals(cl))
return Byte.valueOf((byte) 0);
else if (short.class.equals(cl))
return Short.valueOf((short) 0);
els... | 9 |
public void preencher()
{
list = new ArrayList();
jlist = new JList(new DefaultListModel());
adicionar = new JButton("Adicionar");
adicionar.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent arg0)
{
if (pesquisa.getSelectedIndex() >= 0)
inserir();
}
});
r... | 3 |
public Content getCrossClassLink(String qualifiedClassName, String refMemName,
Content label, boolean strong, String style,
boolean code) {
String className = "";
String packageName = qualifiedClassName == null ? "" : qualifiedClass... | 7 |
protected KeyListener createKeyListener() {
return new KeyListener() {
public void keyPressed(KeyEvent e) {
if (e.getKeyChar() == KeyEvent.CHAR_UNDEFINED || e.getKeyCode() == KeyEvent.VK_DELETE) {
if (editMode)
handleKeyPressed(e.getKeyCode... | 6 |
private int getBonuses() {
int bonus = 0;
if (developments.isDevelopmentBought(DevelopmentList.ARCHITECTURE)) {
for (int i = 0; i < monuments.length; i++) {
if (monuments[i].isFull()) {
bonus++;
}
}
}
if (developments.isDevelopmentBought(DevelopmentList.EMPIRE)) {
for (int i = 0; i < citie... | 6 |
public static void main(String s[]) throws IOException
{
FileInputStream fis = new FileInputStream("/Users/arun/Hack/file-ip-test.txt");
Scanner sc = new Scanner (fis, "UTF-8");
ArrayList<bean1> al = new ArrayList<bean1>();
log("Input from file:");
while(sc.hasNextLine())
{
String s1;
S... | 2 |
public void register(){
try {
Class.forName("com.mysql.jdbc.Driver");
} catch (ClassNotFoundException e) {
e.printStackTrace();
}
} | 1 |
public AnnotationVisitor visitParameterAnnotation(
final int parameter,
final String desc,
final boolean visible)
{
return new SAXAnnotationAdapter(getContentHandler(),
"parameterAnnotation",
visible ? 1 : -1,
parameter,
... | 1 |
private static void generatedConsolidatedHTML(final Map<File, AnalysisData> processedWorkflows) {
try {
final File globalAnalyze = new File("global-analyze.html");
final FileWriter gaWriter = new FileWriter(globalAnalyze);
gaWriter.write("<html>");
gaWriter.write("<body>");
// Consolidated analyze
... | 6 |
public List<THandler> readClass(Class<?> clazz) {
List<THandler> handlers = new ArrayList<THandler>();
ClassHelper classHelper = new ClassHelper(clazz);
TClassMeta classMeta = metadataReader.readClass(clazz, classHelper);
if(classMeta == null) {
return handlers;
}
... | 9 |
@Test
public void findsCorrectDefaultInputs()
{
assertTrue(settings.getControl(KeyEvent.VK_RIGHT) == Input.PLR1RIGHT &&
settings.getControl(KeyEvent.VK_LEFT) == Input.PLR1LEFT &&
settings.getControl(KeyEvent.VK_UP) == Input.PLR1UP &&
settings.getControl(Ke... | 4 |
public String tokenType(int priorState){
switch(priorState){
case 0:
return "ESPACIO";
case 8:
return "IF"; //Palabra reservada if
case 11:
return "ELSE"; //Palabra reservada else
case 1:
return "ID"... | 9 |
public void initTextures(AssetManager assetManagere){
Glass.glassTexture = assetManagere.loadTexture("Textures/Blocks/glass.png");
} | 0 |
public int layoutProjectedRectangle(ArrayList<Rectangle> rectangles){
/*
0 is no intersections.
1 is ground intersection
2 is wall intersection
*/
Rectangle projectedRectangle=new Rectangle((int)(_xcor+_xvel),(int)(_ycor+_yvel+GRAVITY+ 0.99),PLAYER_WIDTH,PLAYER_HEIGHT);
for(int i = 0; i < rectangles.size... | 9 |
public AbsGameObject getMapObject(EnGameObjectType gameObjectType, Coordinate coordinate) {
AbsGameObject absGO = null;
switch (gameObjectType) {
case EXIT:
absGO = new Exit(coordinate);
break;
case MONSTER:
absGO = new Monster(coo... | 6 |
public void setTilesetImageFilename(String name) {
if (name != null) {
tilebmpFile = new File(name);
tilebmpFileLastModified = tilebmpFile.lastModified();
}
else {
tilebmpFile = null;
}
} | 1 |
@Override
public boolean onCommand(CommandSender sender, Command command, String commandlabel, final String[] args) {
if(sender instanceof Player) {
Player player = (Player) sender;
// Valid command format
if(args.length >= 1) {
// casino add
if(args[0].equalsIgnoreCase("add")) {
cm... | 9 |
public final void update() {
// timestamp of last update
float secondsSinceLastUpdate = ((float) World.getWorld().getCurrentTS() - lastUpdateTS) / 1000;
lastUpdateTS = World.getWorld().getCurrentTS();
if (secondsSinceLastUpdate == 0f) {
return;
}
applyForces();
posSpeed.x += posAccel.x * secondsSince... | 9 |
public void test_20_Nmers_read_write() {
String testFile = "/tmp/nmer_test.bin";
int nmerSize = 32;
int numNmers = 100000;
try {
// Initialize
FileOutputStream os = new FileOutputStream(new File(testFile));
Random rand = new Random(20100825);
ArrayList<Nmer> list = new ArrayList<Nmer>();
// Crea... | 4 |
public String toString()
{
return super.toString() + ": \"" + getLabel() + "/" + getOutput() + "\"";
} | 0 |
public static SubmitBatch_Result submitBatch(Database database, SubmitBatch_Param params) {
Logger.getLogger(API.class.getName()).log(Level.FINE, "Entering API.submitBatch()");
SubmitBatch_Result result;
try { // validate user
ValidateUser_Result vResult = validateUser(datab... | 8 |
public PointPathFinding trouverPoint(PointPathFinding point, double diffX, double diffY, ArrayList<PointPathFinding> visites) {
double x = point.getX();
double y = point.getY();
int cout = point.getCout();
PointPathFinding trouve = getPointExistant(x+diffX, y+diffY, visites);
if(... | 7 |
@Override
public void restoreTemporaryToDefault() {tmp = def;} | 0 |
public static String escapeXml( String str ) {
if ( str == null ) {
return str;
}
int len = str.length();
if ( len == 0 ) {
return str;
}
StringBuffer encodedBuffer = new StringBuffer();
// parse string and encode characters
for (int i = 0; i < len; i++) {
char chr= str.charAt(i);
if ( ... | 8 |
public void drawCurrentBlock(Graphics g){
//画指针
g.setColor(Color.red);
switch(this.current_type){
case 0:
g.drawRect(pointer_y * 10 + 50, pointer_x * 10 + 50, 10, 10);
break ;
case 1:
g.drawImage(grass, pointer_y * 10 + 50, pointer_x * 10 + 50, 10, 10, this);
break ;
case 2:
g.drawImage(this.... | 5 |
public static void main(String[] args) throws Throwable{
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
for (String line ; (line=in.readLine())!=null;) {
int cantL = Integer.parseInt(line);
if(cantL == 0 )break;
boolean pass = true;
int nocturnas=0;
int total=0;
for (in... | 9 |
private void findFile(File file, String filename)
{
if (file.isDirectory() && isApplication(file) == false)
{
// System.out.println("Checking Directory: " + file);
File[] files = file.listFiles(this);
if (files != null)
{
for (int i = 0; i < files.length; i++)
{
findFile(files[i], filenam... | 5 |
public JSONArray toJSONArray(JSONArray names) throws JSONException {
if (names == null || names.length() == 0) {
return null;
}
JSONArray ja = new JSONArray();
for (int i = 0; i < names.length(); i += 1) {
ja.put(this.opt(names.getString(i)));
}
re... | 3 |
public E poll()
{
if (count == 0) return null;
E r = peek();
head = (head + 1) % elements.length;
count--;
modcount++;
return r;
} | 1 |
@Override
public void startDocument() throws SAXException {
try {
response = clazz.newInstance();
} catch (InstantiationException e) {
e.printStackTrace();
} catch (IllegalAccessException e) {
e.printStackTrace();
}
} | 2 |
private static void Poda_CreaArbol(Nodo ini, int limite) {
if(limite==0){
ini.calcula_utilidad();
}
else{
ArrayList<Nodo> sucesores= ini.getSucesores();
if(ini.esHoja()){
ini.calcula_utilidad();
}
else{
Iterator<Nodo> it=sucesores.iterator();
while(it.hasNext()&&ini.alfa<ini.beta){
... | 8 |
public static String getDateFormatPattern( String ifmt )
{
if( ifmt.equals( "14" ) )
{
return "m/d/yy";
}
if( ifmt.equals( "15" ) )
{
return "d-mmm-yy";
}
if( ifmt.equals( "16" ) )
{
return "d-mmm";
}
if( ifmt.equals( "17" ) )
{
return "mmm-yy";
}
if( ifmt.equals( "22" ) )
{
... | 5 |
public String login() {
Application app=new ConnectClass().connect();
try
{
app.label("Markets").verify();
app.label("Login").tap();
}
catch(MonkeyTalkFailure ex)
{
System.out.println("Login Page");
}
app.input("701").enterText(user);
app.input("702").enterText(passwo... | 7 |
@Override
public void run() {
Object o;
try {
while ((o = obInputStream.readObject()) != null) {
Order rOrder = (Order) o;
if(warehouse.authUser(rOrder.getUsername(),rOrder.getPassword())){
warehouse.addOrder(rOrder);
outThread.sentOrder(rOrder);
} else {
System.out.println("Käuferanf... | 4 |
public void log(String text, LOG_TYPES type) {
if (!can)
return;
switch (type) {
case DEBUG:
if (ConstantHandler.LOG_DEBUG)
out.println("DEBUG: " + System.nanoTime() + " " + text);
break;
case EVENT:
if (ConstantHandler.LOG_EVENT)
out.println("EVENT: " + System.nanoTime() + " " + text);
... | 9 |
public static float[][] generator(int rows, int cols){
float edgefraction[][] = new float[rows][cols];
//Edge fraction (random numbers between 0-1)
for (int i = 0; i < rows; i++){
for (int j = 0; j < cols; j++){
Random rnd = new Random();
edgefraction[i][j] = rnd.nextFloat();
}
}
//Norm... | 5 |
public void setBoxId(int boxId) {
this.boxId = boxId;
} | 0 |
private static Class[] getClassType(String desc, int descLen,
int start, int num) {
int end = start;
while (desc.charAt(end) == '[')
++end;
if (desc.charAt(end) == 'L') {
end = desc.indexOf(';', end);
if (end < 0)
... | 5 |
protected void loadFields(com.sforce.ws.parser.XmlInputStream __in,
com.sforce.ws.bind.TypeMapper __typeMapper) throws java.io.IOException, com.sforce.ws.ConnectionException {
super.loadFields(__in, __typeMapper);
__in.peekTag();
if (__typeMapper.isElement(__in, CreatedBy__typeInfo)) {
... | 9 |
@Override
public void draw(Graphics page) {
planeImage.drawImage(page, xLocation, yLocation);//Draws the plane on the component
//Draws the collision Border
if(this.getBorderVisibility())
{
drawCollisionBorder(page,xLocation,yLocation,planeImage.getWidth(),planeImage.getHeight());
}
} | 1 |
public void changeHighScore(int newscore, String name){
if (newscore > first){ //if the new score is the first one on the new table
this.fifth= this.forth;
this.forth= this.third;
this.third= this.second;
this.second= this.first;
this.first= newscore;
this.fifthHighScore.setText("5." + (this.forthHi... | 6 |
public boolean removeWhen(SingleObject bl){
boolean remove=bl.inRange(stage.player)
|| !bl.inArea(-20,stage.getWidth()+20,-50,stage.getHeight()-100)
|| stage.second()>16;
if(remove && grade=='f'){
stage.getSound("audio/f_explode.wav").play();
stage.impact=true;
... | 4 |
@Override
public boolean okMessage(final Environmental myHost, final CMMsg msg)
{
if(!super.okMessage(myHost,msg))
return false;
if(affected==null)
return true;
if(!(affected instanceof MOB))
return true;
if(msg.target()==affected)
{
if((msg.tool()!=null)
&&(CMLib.dice().rollPercentage()>... | 7 |
@Override
public boolean invoke(MOB mob, List<String> commands, Physical givenTarget, boolean auto, int asLevel)
{
final MOB target=this.getTarget(mob,commands,givenTarget);
if(target==null)
return false;
if(!super.invoke(mob,commands,givenTarget,auto,asLevel))
return false;
boolean success=proficienc... | 7 |
public void run() {
Object o;
try {
while ((o = obInputStream.readObject()) != null) {
Order rOrder = (Order) o;
controllerCoustomerShop.setreceivedOrder(rOrder);
}
} catch (ClassNotFoundException | IOException e) {
e.printStackTrace();
} finally {
try {
obInputStream.close();
} catch... | 3 |
public String getCalle() {
return Calle;
} | 0 |
public int compare(Problem a, Problem b) {
int result = 0;
Problem pa = (Problem)a;
Problem pb = (Problem)b;
if (sortField.equals("host_name")) {
result = pa.getHost().getHostName().compareTo(pb.getHost().getHostName());
}
else if (sortField.equals("pretty_name") || sortField.equals("server_name")) {
... | 8 |
public static byte[] decodeBytes(byte[] encdata, int encoff, int enclen, com.grey.base.utils.ByteChars arrh)
{
if (enclen == 0) return null;
int enclimit = encoff + enclen;
int rawoff = 0;
int datalimit = enclimit;
int paddinglen = 0;
int linecnt = 0;
// count pad chars - there's no legal encoded sequen... | 9 |
public static void main(String[] argv)
{
try
{
Controllers.create();
}
catch (Exception e)
{
e.printStackTrace();
System.exit(0);
}
int count = Controllers.getControllerCount();
System.out.println(count + " Controllers Found");
for (int i = 0; i < count; i++)
... | 6 |
static AdjGraph segmentArrangement(Line[] segs, List<Point> ps) {
int n = segs.length;
TreeSet<Point> set = new TreeSet<Point>(); // JavaのリストにはC++のuniqueがないので…
for (int i = 0; i < n; i++) {
set.add(segs[i].a);
set.add(segs[i].b);
for (int j = i + 1; j < n; j+... | 7 |
@Override
public List<Map<String, ?>> Listar_dat_actual(String ID_TRABAJADOR) {
List<Map<String, ?>> lista = new ArrayList<Map<String, ?>>();
try {
this.cnn = FactoryConnectionDB.open(FactoryConnectionDB.ORACLE);
String sql = "SELECT * FROM RHVD_NEW_TRABAJADOR \n"
... | 9 |
static Method[] getMethodList(Class clazz) {
Method[] methods = null;
try {
// getDeclaredMethods may be rejected by the security manager
// but getMethods is more expensive
if (!sawSecurityException)
methods = clazz.getDeclaredMethods();
} cat... | 8 |
public GeometricNodeEnumeration(Node n){
if(sNLE == null){
sNLE = new GeometricNodeListEnumeration(n);
}
else{
sNLE.resetForNode(n);
}
if(sNLE.hasMoreElements()){
nI = sNLE.nextElement().iterator();
}
} | 2 |
public void determineValues(Instances inst) {
int i;
AttributeStats stats;
int attIdx;
int min;
int max;
int count;
m_AttIndex.setUpper(inst.numAttributes() - 1);
attIdx = m_AttIndex.getIndex();
// init names
m_Values = new HashSet... | 9 |
private ByteBuffer getReader(int bytes)
{
ByteBuffer reader = buffers[readerIndex];
if (readerPosition + bytes > reader.limit())
{
if (readerPosition == reader.limit()) {
reader = nextReader();
}
else {
reader = nextCompactedReader(bytes);
}
}
return reader;
} | 2 |
public void run()
{
try
{
this.MPrio.acquire();
this.MReading.acquire();
this.MPrioR.acquire();
if(this.counter == 0)
this.MWriting.acquire();
this.counter++;
this.MPrioR.release();
this.MReading.release();
System.out.println("Lecture");
Thread.sleep(100);
... | 3 |
@Override
public Message postMessage(Message msg) throws JSONException, BadResponseException {
Representation r = new JsonRepresentation(msg.toJSON());
r = serv.postResource("intervention/" + interId + "/message", msg.getUniqueID(), r);
Message message = null;
try {
message = new Message(new JsonReprese... | 1 |
public Jagd(JSONObject setup) {
super("Wörterjagd");
try {
letterMin = setup.getInt("min");
} catch (JSONException e) {
}
try {
letterMax = setup.getInt("max");
} catch (JSONException e) {
}
try {
percent = setup.getInt("Prozent");
} catch (JSONException e) {
}
try {
luck = setup.getB... | 6 |
public String getCode() {
return code;
} | 0 |
private void finishText() {
if (currentText != null) {
String strValue = currentText.toString();
if (currentTextContent != null) {
if (DefaultXmlNames.ELEMENT_Unicode.equals(insideElement)) {
currentTextContent.setText(strValue);
}
else if (DefaultXmlNames.ELEMENT_PlainText.equals(insideEl... | 9 |
public static ProgressRateEnumeration fromString(String v) {
if (v != null) {
for (ProgressRateEnumeration c : ProgressRateEnumeration.values()) {
if (v.equalsIgnoreCase(c.toString())) {
return c;
}
}
}
throw new IllegalArgumentException(v);
} | 3 |
@Override
public void run() {
long lastTime = System.nanoTime();
double nsPerTick = 1000000000D / 60D;
long lastTimer = System.currentTimeMillis();
delta = 0D;
while (running) {
long now = System.nanoTime();
delta += (now - lastTime) / nsPerTick;
lastTime = now;
// If you want to limit frame r... | 6 |
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.