text stringlengths 14 410k | label int32 0 9 |
|---|---|
private void conectBotonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_conectBotonActionPerformed
if(userTF.getText().equals("") && passTF.getText().equals("") && ipTF.getText().equals("")
&& portTF.getText().equals("") && dbTF.getText().equals(""))
{
JOptionP... | 8 |
public void deleteIssueFired(ActionEvent event) {
final String selectedProject = getSelectedProject();
if (model != null && selectedProject != null && table != null) {
// We create a copy of the current selection: we can't delete
// issue while looping over the live selection,... | 6 |
public static String getLocationData() {
HttpURLConnection urlConnection = null;
BufferedReader reader = null;
String geoip = null;
final String GEO_IP = "http://www.telize.com/geoip";
try {
URL url = new URL(GEO_IP);
urlConnection = (HttpURLConnection)... | 7 |
private void refreshScriptActions() {
Iterator<String> it = vetScript.iterator();
// Skip "serialNumber".
if (it.hasNext()) {
it.next();
}
// Get number of actions and discovers how many digits it has.
int total = vetScript.size();
int nDigits = 0;
while (total > 0) {
total = total / 10;
nDig... | 5 |
@Override
public void caseAIdxAcsStmt(AIdxAcsStmt node)
{
inAIdxAcsStmt(node);
if(node.getSmc() != null)
{
node.getSmc().apply(this);
}
if(node.getAssgn() != null)
{
node.getAssgn().apply(this);
}
if(node.getEq() != null)
... | 7 |
@Override
protected void map(LongWritable key, Text value, Context context)
throws IOException, InterruptedException {
Boolean has_retweet = true;
JSONObject json;
try {
json = (JSONObject) parser.parse(value.toString());
String time = Utility.convertDateFormat(json.get("created_at").toString())... | 8 |
public void setFakeResult(){
/*
* 村人騙りなら不必要
*/
if(fakeRole == Role.villager){
return;
}
//偽占い(or霊能)の候補.以下,偽占い候補
List<Agent> fakeGiftTargetCandidateList = new ArrayList<>();
List<Agent> aliveAgentList = getLatestDayGameInfo().getAliveAgentList();
aliveAgentList.remove(getMe());
for(Agent agen... | 9 |
@Override
public void paint(Graphics g) {
try {
ImageIcon img = null;
if ("".equals(modal)) {
img = new ImageIcon(this.getClass().getResource(
"/images/" + name + ".png"));
} else {
img = new ImageIcon(this.getClass().getResource(
"/images/" + name + "_" + modal + ".png"));
}
if (i... | 4 |
public Sentiment[] getSentiment ( String text ) {
// System.out.println(text);
text = cleanText(text);
// System.out.println(text);
Sentiment[] result = new Sentiment[text.split("\\.").length];
int i = 0;
int count = 0;
int tense = 0;
Double score = 0.0;
... | 4 |
public int compare(SimNode o1, SimNode o2) {
// TODO Auto-generated method stub
double numbera = o1.getSim();
double numberb = o2.getSim();
if(numberb > numbera)
{
return 1;
}
else if(numberb<numbera)
{
return -1;
}
else
{
return 0;
}
} | 2 |
@Override
public boolean equals(Object object) {
// TODO: Warning - this method won't work in the case the id fields are not set
if (!(object instanceof DatasetUpdateFrequency)) {
return false;
}
DatasetUpdateFrequency other = (DatasetUpdateFrequency) object;
if (... | 5 |
public KeyInfo load(String password) throws CertificateException, IOException, KeyStoreException, NoSuchAlgorithmException
{
FileInputStream fin = null;
try {
char[] psw = password.toCharArray();
String alias = "";
this.keyInfo = null;
fin = n... | 2 |
public Range getHelix(int index)
{
if((index<0)||(index>=_str.length))
{ return new Range(index,index);}
int j = _str[index];
if(j!=-1)
{
int minH = index;
int maxH = index;
if (j>index)
{ maxH = j; }
else
{ minH = j; }
boolean over = false;
while (!over)
{
if((... | 8 |
public void setUser(User newUser)
{
if (newUser == null || (user != null && newUser.getID().equals(user.getID())))
return;
if ( (newUser.lastLog == null)
|| (System.currentTimeMillis() - newUser.lastLog.getTime()) > 600_000)
{ // if lastlog is older then 10 min or first login
newUser.logins++;
}... | 5 |
@Override
public int hashCode() {
int result = alpha != null ? alpha.hashCode() : 0;
result = 31 * result + (red != null ? red.hashCode() : 0);
result = 31 * result + (green != null ? green.hashCode() : 0);
result = 31 * result + (blue != null ? blue.hashCode() : 0);
return r... | 4 |
@Override
public void encode(final ByteBuffer buf, final StringBuilder log)
{
encoder.encode(buf, log);
final byte tick_time = (byte) 10;
final byte ticks = (byte) 240;
buf.put(tick_time);
buf.put(ticks);
final short body_size = (short) body.getRequestSize();
... | 4 |
public boolean instanceOf(Object obj, String className)
throws InterpreterException {
Class clazz;
try {
clazz = Class.forName(className);
} catch (ClassNotFoundException ex) {
throw new InterpreterException("Class " + ex.getMessage()
+ " not found");
}
return obj != null && !clazz.isInstance(ob... | 2 |
private void setVotableResource(final DataSetApplication datasetApp, final SimpleSpectralAccessInputParameters inputParameters,
final ResourceModel model, final String dictionaryName) {
final List<Field> fieldList = new ArrayList<Field>();
final List<String> columnList = new ArrayList<String>();
... | 6 |
public static void leastPaidEmployees(EntityManager entityManager) {
TypedQuery<Employee> query = entityManager.createQuery(
"select e from Employee e order by e.salary asc",
Employee.class);
query.setMaxResults(2);
List<Employee> resultList = query.getResultList();
entityManager.close();
for (E... | 1 |
public void refuel(int fuel) {
tank.refuel(fuel);
if(!tank.isEmpty()) {
setDead(false);
}
} | 1 |
public Expr pop1() {
final Expr top = (Expr) stack.remove(stack.size() - 1);
final Type type = top.type();
if (type.isWide()) {
throw new IllegalArgumentException("Expected a word "
+ ", got a long");
}
height--;
return top;
} | 1 |
public static void winLose(){
if (Empous.Gov.getStat("publicopinion")>100){
UpdateView finalUpdate = new UpdateView(0);
finalUpdate.display();
System.out.println("YOU'RE WINNER!");
}
else if (Empous.Gov.getStat("publicopinion")==0){
UpdateView finalUpdate = new UpdateView(0);
finalUpdate.display();... | 2 |
public Point getTileCollision(Sprite sprite,
float newX, float newY)
{
float fromX = Math.min(sprite.getX(), newX);
float fromY = Math.min(sprite.getY(), newY);
float toX = Math.max(sprite.getX(), newX);
float toY = Math.max(sprite.getY(), newY);
// get the tile loca... | 5 |
public void step()
{
if( !ready && source.ready )
{ init(); }
if( !run || !ready ) return;
if( actions!=null && frame<actions.length )
if( actions[frame]!=null )
actions[frame].exec(this);
frame=(frame+1)%size;
} | 7 |
public Builder mass(double receivedMass) {
if (receivedMass < 0) {
log.warn("Wrong Mass. receivedMass =", receivedMass);
throw new IllegalArgumentException("Mass must be > 0 Received value =" + receivedMass);
}
this.mass = receivedMass;
ret... | 1 |
public /*@non_null@*/ int [] getSelection() {
if (m_Upper == -1) {
throw new RuntimeException("No upper limit has been specified for range");
}
int [] selectIndices = new int [m_Upper + 1];
int numSelected = 0;
if (m_Invert)
{
for (int i = 0; i <= m_Upper; i++) {
if (!m_SelectFlags... | 8 |
@Override
public int lookup(String key){
if (key == null || key.isEmpty())
return UNKNOWN_ID;
CodeSequence cs = thl.get();
cs.set(key, codemap_);
int src = ROOT ;
int pos = 0 ;
while (pos < cs.size_){
int dest = Node.BASE(nodes_[src]) + cs.s... | 8 |
final boolean method1158() {
if (anIntArray2085 == null) {
return anInt2065 != -1 || anInt2101 != -1 || anInt2098 != -1;
}
for (int i = 0; i < anIntArray2085.length; i++) {
if (anIntArray2085[i] != -1) {
NPCComposite NPCComposite = Class21.npcCompositeForI... | 8 |
public static void main(String[] args) {
System.out.println(1 + 2 * 3); // 7
System.out.println((1 + 2) * 3); // 9
System.out.println(1 + (2 * 3)); // 7
} | 0 |
public int getBlockId(int par1, int par2, int par3)
{
if (par2 < 0)
{
return 0;
}
else if (par2 >= 256)
{
return 0;
}
else
{
int var4 = (par1 >> 4) - this.chunkX;
int var5 = (par3 >> 4) - this.chunkZ;
... | 7 |
@Override
public void actionPerformed(ActionEvent e) {
if (e.getSource().equals(mat)) {
String selected = mat.getText();
Materie materie_noua = null;
for (Materie m : Centralizator.getInstance().getMaterii()) {
if (m.getNume().equals(selected)) {
materie_noua = m;
return;
}
}
if (ma... | 8 |
protected void processConnection(StreamConnection connection) {
LOGGER.entry(connection);
if (stopRequested) {
LOGGER.exit();
return;
}
DataInputStream dis;
try {
dis = connection.openDataInputStream();
} catch (IOException e) {
LOGGER.catching(e);
LOGGER.exit();
return;
}
boolean c... | 7 |
private float blink(float alpha){
this.alpha += this.velocity;
if(this.alpha > 255 || this.alpha < 0){
this.velocity = -this.velocity;
}
return this.alpha;
} | 2 |
public long seek(long offset, int seekOrigin) throws java.io.IOException {
if (bufferSize > 0) {
stream.write(buf.array(), 0, bufferSize);
buf.clear();
bufferSize = 0;
}
if (seekOrigin == STREAM_SEEK_SET) {
stream.seek(offset);
} else if (s... | 3 |
public static boolean updateAvailable() throws Exception {
String version = plugin.getDescription().getVersion();
URL url = new URL("http://api.bukget.org/api2/bukkit/plugin/everlastingweather/latest");
InputStreamReader isr;
try {
isr = new InputStreamReader(url.openStream()... | 6 |
public static KeyValueList collectForwardChainingRules(Description description, Object [] MV_returnarray) {
{ MemoizationTable memoTable000 = null;
Cons memoizedEntry000 = null;
Stella_Object memoizedValue000 = null;
if (Stella.$MEMOIZATION_ENABLEDp$) {
memoTable000 = ((MemoizationTable)(... | 6 |
protected void end() {
Robot.driveTrain.tankDrive(0, 0);
} | 0 |
protected synchronized void processEvent(Sim_event ev)
{
/***** NOTE: debugging information
System.out.println(super.get_name() +
".processEvent(): Event was scheduled for " + ev.event_time());
System.out.println(super.get_name() +
".processEvent(): ev.get_tag() is " + ev.g... | 4 |
private static void printNode(NodeList nodeList) {
for (int count = 0; count < nodeList.getLength(); count++) {
Node tempNode = nodeList.item(count);
// make sure it's element node.
if (tempNode.getNodeType() == Node.ELEMENT_NODE) {
// get node name and valu... | 5 |
public JSONObject toJSONObject(String languagecode, String p) {
JSONObject jresult = new JSONObject();
if (p.equals("*")) {
JSONArray ar = new JSONArray();
jresult.put("properties", ar);
for(Iterator<String> i = this.getKeys(); i.hasNext();){
JSONObject n = new JSONObject();
String key = i.next();
... | 5 |
static private Point[] dodecahedron() {
Point[] ret = new Point[20];
final double GOLDEN = (1 + sqrt(5)) / 2;
int i = 0;
for (int x = -1; x <= +1; x++) {
for (int y = -1; y <= +1; y++) {
for (int z = -1; z <= +1; z++) {
if (x * y * z != 0) ... | 7 |
@Override
public synchronized void unRegisterClient(Trader trader)
throws RemoteException, RejectedException {
if (!this.registeredTraders.contains(trader))
throw new TraderNotExistsException(trader);
for (Item it : this.itemsOnSale) {
if (it.getOwner().equals(trader)) {
this.itemsOnSale.remove(it);
... | 5 |
public void extractor() throws UnknownHostException, InterruptedException {
int c = 0;
conf.init();
while (true) {
double lastProcessTime = 0;
DB db = Mongo.connect(new DBAddress(conf.getSourceHost(), conf.getSourceMongoDBName()));
DB proDb = Mongo.connect(new... | 8 |
@Override
public void run() {
try {
report ("saving started", 1);
//note: this iterator does not require locking because of CopyOnWriteArrayList implementation
for (AbstractPage child: page.childPages)
jobMaster.submit(new SaveDataJob(child,jobMaster));
if (!page.saveResult(this))
report("... | 4 |
private void executeDockCommand(String[] commandString, Player player) throws CommandException {
if (DockCommand.isDockCommand(commandString[0])) {
DockCommand firstCommand = DockCommand.toCommand(commandString[0]);
switch (firstCommand) {
case UNDOCK:
undock(... | 7 |
public void setEnabled(boolean enabled) {
if (!m_enabled && enabled) {
// if the state changed to enable then add the stored handlers
// copy the stored handlers into a new list to avoid concurred access to the list
List<ClickHandler> handlers = new ArrayList<ClickHandler>(m... | 6 |
public static void main(String[] args) {
try {
for (UIManager.LookAndFeelInfo info : UIManager.getInstalledLookAndFeels()) {
if ("Nimbus".equals(info.getName())) {
UIManager.setLookAndFeel(info.getClassName());
break;
}
... | 7 |
public Player returnPlayer(){
return storage;
} | 0 |
public String getUsername() {
String username = "";
if (type == 0 || type == 1) {
if (menuComponents != null) {
if (menuComponents.get(0) != null) {
try {
username = ((MenuTextBoxV2) menuComponents.get(0))
.getSubmitted();
} catch (Exception e) {
}
}
}
}
return usern... | 5 |
public void update(double theta) {
// position.x += theta * direction.x;
obstacle.position.y += theta * velocity.y;
if (obstacle.position.y > Main.game.player.main.position.y - 2 * Main.game.player.main.size &&
obstacle.position.y < Main.game.player.main.position.y + 2 *... | 7 |
public static String pformat(Collection<?> c){
if(c.size() == 0) return "[]";
StringBuilder result = new StringBuilder("[");
for(Object elem : c){
if(c.size() != 1)
result.append("\n ");
result.append(elem);
}
if(c.size() != 1)
result.append("\n");
result.append("]");
return result.toStri... | 5 |
private int checkBox(GameBoardMark playerMark) {
for (int k = 1; k < 8; k++) {
for (int l = 1; l < 8; l++) {
int cnt = 0;
int pos = -1;
for (int a = 0; a < 2; a++) {
for (int b = 0; b < 2; b++) {
int x = k + ... | 8 |
private void drawObjects(Graphics g) {
if (craft.isVisible()) {
g.drawImage(craft.getImage(), craft.getX(), craft.getY(),
this);
}
ArrayList<Missile> alMissiles = craft.getMissiles();
for (Missile m : alMissiles) {
if (m.isVisible()) {
... | 5 |
public static void main(String [] args) throws SQLException
{
DataInitialization thing = new DataInitialization();
if (args[0].equals("destroy"))
{
thing.destroyData();
}
else if (args[0].equals("init"))
{
thing.initialData();
}
} | 2 |
public void writeUTF(String s) throws IOException {
int numchars = s.length();
int numbytes = 0;
for (int i = 0; i < numchars; i++) {
int c = s.charAt(i);
if ((c >= 0x0001) && (c <= 0x007F))
... | 9 |
public static DCPackage getPackage(byte[] raw) throws InputMismatchException{
if(raw.length != PACKAGE_SIZE) {
throw new InputMismatchException("The size of the raw byte input is " + raw.length+" and does not match the expected package size " + PACKAGE_SIZE);
} else {
byte number = raw[0];
if(number < 0 ||... | 4 |
public void process(float newSpeed, double newLatitude, double newLongitude, long newTimeStamp, float newAccuracy) {
// Uncomment this, if you are receiving accuracy from your gps
// if (newAccuracy < Constants.MIN_ACCURACY) {
// newAccuracy = Constants.MIN_ACCURACY;
// }
if... | 2 |
public boolean copy(String frompath, long every, URI tofttppath){//every 8m
/*System.out.println("tofttppath:"+tofttppath);
System.out.println("this.host:"+this.host);
System.out.println("this.port:"+this.port);
System.out.println("tofttppath.getHost:"+tofttppath.getHost());
System.out.println("tofttppath.get... | 9 |
@Override
public Object visitExpression(ExpressionContext ctx, CalcScope scope) {
setCurrentScope(scope);
CalcValue value = new CalcValue();
value.setType(int.class);
if (ctx.getChildCount() == 1) {
if (ctx.integerLiteral() instanceof CalcParser.IntegerLiteralContext) {
value.setValue(visitIntegerLitera... | 9 |
@Override
public boolean invoke(MOB mob, List<String> commands, Physical givenTarget, boolean auto, int asLevel)
{
if(!super.invoke(mob,commands,givenTarget,auto,asLevel))
return false;
final boolean success=proficiencyCheck(mob,0,auto);
if(success)
{
invoker=mob;
final CMMsg msg=CMClass.getMsg(mob,... | 7 |
public Worker () {
//initial settings
isInputActive = true;
this.keyboard = new BufferedReader(new InputStreamReader(System.in));
students = new HashMap<String, Student>();
System.out.println(MSG_WELCOME);
//start
this.lifeCycle();
} | 0 |
private void getCurrentSettings() {
System.out.println("SW| start getCurSets");
mySets = new Settings();
try {
FileInputStream fs = new FileInputStream("settings.txt");
ObjectInputStream os = new ObjectInputStream(fs);
Object obj = os.readObject();
... | 3 |
public VideoStore() throws Exception {
try{
String username = "cs5530u33";
String password = "mdtiepn5";
String url = "jdbc:mysql://georgia.eng.utah.edu/cs5530db33";
Class.forName ("com.mysql.jdbc.Driver").newInstance ();
connection = DriverManager.getConnection (url, username, password);
/*//Drive... | 1 |
public int itc(Model model){
int res = 0;
for(Operation op : this.getArrayOperation()){
for(Argument arg : op.getArg()){
for(Classe c : model.getClasse()){
if(arg.getType().trim().equals(c.getIdentifier().trim())){
res++;
}
}
}
}
//System.out.println("La Classe " + this.identifier ... | 4 |
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
String xquery = "<xml>{ for $cedar in collection('CED2AR') return ";
String[] query = request.getParameter("query").split(" ");
for(int i = 0; i < query.length; i++){
if(i == 0){
xquery +... | 5 |
public boolean isVisible(int row, int col){
return (visited[row][col] == RoomState.VISITED);
} | 0 |
static void lsp_to_curve(float[] curve, int[] map, int n, int ln,
float[] lsp, int m, float amp, float ampoffset){
int i;
float wdel=M_PI/ln;
for(i=0; i<m; i++)
lsp[i]=Lookup.coslook(lsp[i]);
int m2=(m/2)*2;
i=0;
while(i<n){
int k=map[i];
float p=.7071067812f;
floa... | 9 |
public CashOffice registerCashOffice(CashOffice cashOffice) {
int index = cashOffices.indexOf(cashOffice);
if (index == -1) {
addCashOffice(cashOffice);
return cashOffice;
} else {
CashOffice foundedCashOffice = cashOffices.get(index);
// Iterator<Ticket> tickets = cashOffice.ti... | 1 |
@Test
public void testDir() {
Path dir = Paths.get("F:\\\\tmp");
//这个只能列出当前目录下符合的文件
try (DirectoryStream<Path> stream =
Files.newDirectoryStream(dir, "*.txt")) {
System.out.println("=========DirectoryStream start=========");
for (Path path : stream) {
System.out.println(path);
}
System.ou... | 4 |
GUI()
{
super("Michelizer (" + Resources.VERSION_NUMBER + " - " + Resources.VERSION_CODENAME + ") - The All-In-One ECE 460 Solver");
FlowLayout fl = new FlowLayout();
fl.setAlignment(FlowLayout.LEFT);
setLayout(fl);
createPane1();
createPane2();
createPane3();
createPane4();
createPane5();
creat... | 5 |
public Header readFrame() throws BitstreamException
{
Header result = null;
try
{
result = readNextFrame();
// E.B, Parse VBR (if any) first frame.
if (firstframe == true)
{
result.parseVBR(frame_bytes);
firstframe = false;
}
}
catch (BitstreamException ex)
{
if ((ex.getErrorCo... | 6 |
public static void main(String[] args) {
Connection conn = null;
PreparedStatement pstat = null;
ResultSet rs = null;
try {
Class.forName("org.h2.Driver");
/**
* jdbc:h2:tcp://<server>[:<port>]/[<path>]<databaseName>
* jdbc:h2:tcp://localhost/~/test
* jdbc:h2:tcp://dbserv:8084/~/sample
* j... | 8 |
public static MaplePacket showAllianceMembers(MapleCharacter chr) {
MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();
mplew.writeShort(SendPacketOpcode.ALLIANCE_OPERATION);
mplew.write(0x0D);
MapleAlliance az = chr.getGuild().getAlliance(chr.getClient());
int e = 0;
for (int u = 0; u < 5;... | 5 |
public void createDatabase() {
try {
Class.forName("com.mysql.jdbc.Driver");
//String url = "jdbc:mysql://127.0.0.1/interactive_house?user=root&password=";
Connection con = DriverManager.getConnection("jdbc:mysql://127.0.0.1/?user=root&password=root");
ResultSet r... | 7 |
public Vector2 getCollisionPoint(Segment2D other)
{
Vector2 p = getIntersectionPoint(other);
if (p == null)
return null;
if ((p.x >= start.x && p.x <= end.x) || (p.x >= end.x && p.x <= start.x))
{
if ((p.y >= start.y && p.y <= end.y) || (p.y >= end.y && p.y <= start.y))
return p;
}
return null;
... | 9 |
public void start(Stage primaryStage) throws IOException, URISyntaxException
{
musicList = new ArrayList<>();
File musicFile = new File("src/gameMusic");
System.out.println("\"src/gameMusic\" exists?; " + musicFile.exists());
String file = "file:///" + musicFile.getAbsolutePath().replace('\\', '/');
... | 4 |
public static void main(String[] args) {
Man[] myarray = new Man[4];
myarray[0] = new Employee("Mykola", "Myronov");
myarray[1] = new Employee("Evgen", "Mazek");
myarray[2] = new Employee("Олег", "Спека");
myarray[3] = new Employee("Олег", "Спека");
for (Man variant : myarray){
System.out.println(vari... | 1 |
@Test
public void testGetContent() throws Exception {
new BibleContentTw().getContent();
} | 0 |
public String echo(String message)
{
return "hello: " + message;
} | 0 |
private Node getLowestFNode() {
Node out = null;
synchronized (OPENLIST) {
for (Node n : OPENLIST) {
if (out == null)
out = n;
else {
if (n.F < out.F)
out = n;
}
}
}
if (details && out != null) System.out.println("Lowest F Node: ("+out.x+","+out.y+")");
return out;
} | 5 |
public static Moves getRemainingExpansionMoves(BotState state) {
Moves out = new Moves();
List<Region> borderRegions = state.getVisibleMap().getBorderRegions(state);
List<Region> valuableExpansionRegions = new ArrayList<>();
for (Region borderRegion : borderRegions) {
if (isExpandingValuable(state, borderReg... | 6 |
private static JsonObject parseObj(Buffer<Token> buf) throws JsonParseException
{
Token tkn = buf.next();
if (!"{".equalsIgnoreCase(tkn.str))
{
throw new JsonParseException("Found \"%s\" at line %s, col %s; Was expecting \"{\"", tkn.str, tkn.line, tkn.col);
}
JsonObject ret = new JsonObject();
boo... | 6 |
public boolean twoOpt(){
int pathLength=tour.length();
int k=Math.min(160, pathLength);
int progress=0;
boolean better=false;
outer:
for(int currentVerticeIndex=0; currentVerticeIndex<pathLength;currentVerticeIndex++){
// for(int currentVerticeIndex=0; progress<pathLength; progress++){
// currentVert... | 9 |
public void setjLabelNom(JLabel jLabelNom) {
this.jLabelNom = jLabelNom;
} | 0 |
public void idle(){
if (!armChannel.getAnimationName().equals("ArmIdle") && !hasSwung){
armChannel.setAnim("ArmIdle");
}
if (!legChannel.getAnimationName().equals("LegsIdle")){
legChannel.setAnim("LegsIdle");
}
} | 3 |
private void resize(int capacity)
{
assert capacity >= N;
Key k[] = (Key[]) new Comparable[capacity];
Value v[] = (Value[]) new Object[capacity];
System.arraycopy(keys, 0, k, 0, (keys.length < k.length) ? keys.length
: k.length);
keys = k;
System.arraycopy(vals, 0, v, 0, vals.length);
vals = v;
} | 1 |
public boolean deleteReminder(String pid,int alertType){
logger.error("Deleting the patient with patient id:"+pid+" for alert:"+alertType);
boolean deletePatient=false;PAlert patientAlert=null;
Patient patient=getPatient(pid);
List list=getpatientAlert(pid,alertType);
if(list!=null && list.size()>0)
patien... | 7 |
private Response takeAnswer() throws IOException{ //Implementation to take answer input. Used for storing user responses and storing answer keys.
String s;
HashMap<String, ArrayList<String>> dictAns = new HashMap<String, ArrayList<String>>(); //HashMap to pass to Response
for (int i=0; i < getLeft().size(); i+... | 7 |
public static int getTypeSize(String typeSig) {
return usingTwoSlots(typeSig.charAt(0)) ? 2 : 1;
} | 1 |
private static <T> T attemptLoad(
final Class<T> ofClass,
final String className) {
if (LOG.isLoggable(Level.FINEST)) {
LOG.finest("Attempting service load: " + className);
}
Level level;
Throwable thrown;
try {
Class<?> clazz = Cla... | 8 |
public String doValidate(Number value) {
long l = value.longValue();
if (l > max)
return "Is larger than " + max;
if (l < min)
return "Is smaller than " + min;
return null;
} | 2 |
public static void loadConstants() {
try {
//get a connection to the constants file and read it
final String fileName = "file:///" + CONSTANTS_FILE_NAME;
printIfDebug("Opening constants file: " + fileName);
FileConnection commandFileConnection = (FileConnection) C... | 5 |
public int[] searchRange(int[] A, int target) {
// Start typing your Java solution below
// DO NOT write main() function
if (A.length == 0) {
return new int[] { -1, -1 };
}
int[] range = new int[2];
int start = 0;
int end = A.length - 1;
int mid;
int left = -1;
int right = -1;
while (start <=... | 8 |
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
for (int y = 0; y < boardSize; ++y) {
for (int x = 0; x < boardSize; ++x) {
String player = " ";
if (intersections[x][y] == PLAYER_1) {
player = "X";
} else if (intersections[x][y] == PLAYER_2) {
player = "O";
... | 4 |
@Override
protected void balancing() {
super.balancing();
if (this.balance() == 2) {
if (this.getRight().balance() >= 0)
this.leftRotation();
else {
this.getRight().rightRotation();
this.leftRotation();
}
} else if (this.balance() == -2) {
if (this.getLeft()... | 4 |
public Term negate() {
Term[] t=new Term[sub.length];
boolean w=true;
for(int i=0;i<t.length;i++) {
if(w&&sub[i].isNegative()) {
w=false;
t[i]=sub[i].negate();
}
else {
t[i]=sub[i];
}
}
... | 4 |
@Override
public void extract() throws XMLStreamException, FileNotFoundException
{
FileInfo ulic = this.bfis.get(Parser.Types.ULIC.toString());
this.factory = XMLInputFactory.newInstance();
this.readerRaw = factory.createXMLStreamReader(new BufferedInputStream(new FileInputStream(... | 5 |
public void choixActionBraquage()
{
int choix = 0;
boolean recommencer = true;
System.out.println("Que voulez-vous faire ?"
+ "\nVous avez le choix entre vous cacher (tapez 1) ou vous interposer (tapez 2)");
do{
try{
choi... | 6 |
private void buildAmineDiConjunctiveSuffix(List<Element> words) throws StructureBuildingException {
for (Element word : words) {
if (!WordType.full.toString().equals(word.getAttributeValue(TYPE_ATR))){
throw new StructureBuildingException("Bug in word rule for amineDiConjunctiveSuffix");
}
resolveWordOrB... | 9 |
@Override
public List<E> inRectangle(Vector corner1, Vector corner2) {
ArrayList<E> toReturn = new ArrayList<>();
for (E item : list){
Vector p = item.getPosition();
if (p.x >= corner1.x && p.x <= corner2.x &&
p.y >= corner1.y && p.y <= corner2.y)
list.add(item);
}
return toReturn;
} | 5 |
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.