text stringlengths 14 410k | label int32 0 9 |
|---|---|
@Override
public Object decorate(final ClassLoader loader, final Field field) {
if (IContainer.class.isAssignableFrom(field.getType())) {
return decorateContainer(loader, field);
}
if (IElement.class.isAssignableFrom(field.getType())) {
return decorateElement(loader, field);
}
if (List.class.isAssigna... | 3 |
public void merge(String nameI, String nameO) {
float[][] data = new float[0][0];
int size = 0;
try {
DataInputStream dis = new DataInputStream(new BufferedInputStream(new FileInputStream(nameI)));
size = dis.readInt();
data = new float[size][size];
... | 7 |
public boolean add(T item, List<T> old) {
// Parameters may not be null and the list object provided must initially contain the item
// being added to the TimeOutList.
if (item == null || old == null || !old.contains(item))
throw new IllegalArgumentException();
// Remove the item from its previous location.
... | 3 |
@Override
public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
if(label.equalsIgnoreCase("irc"))
{
if(args[0].equalsIgnoreCase("help"))
{
sender.sendMessage(ChatColor.GREEN + "AprilonIrc by HAPPYGOPUCKEY");
... | 6 |
public boolean renderBlockDragonEgg(BlockDragonEgg par1BlockDragonEgg, int par2, int par3, int par4)
{
boolean flag = false;
int i = 0;
for (int j = 0; j < 8; j++)
{
int k = 0;
byte byte0 = 1;
if (j == 0)
{
k = 2;
... | 9 |
@Override
public Event findEventByEventId(int eventId) {
Event event = null;
Connection cn = null;
PreparedStatement ps = null;
ResultSet rs = null;
try {
cn = ConnectionHelper.getConnection();
ps = cn.prepareStatement(QTPL_SELECT_BY_EVENT_ID);
... | 5 |
public static boolean eliminar( Integer id, boolean destruir) throws ObjetoNoEncontradoExcepcion
{
Cliente cliente = Cliente.buscar( id);
if (cliente == null)
throw new ObjetoNoEncontradoExcepcion( "El cliente con id " + id + " no existe");
// Se elimina la informacin del producto en las tiendas.
ArrayList... | 5 |
@Override
public boolean hasNext() {
if (first == null)
return false;
return !(current == null);
} | 1 |
private void transferChanges() {
//brand new group
if (editingFilt == null) {
editingFilt = new Group(manager.getUId(), "", 0, null);
//original = (Group) editingFilt.clone();
}
if (groupList.getSelectedIndex() == 0) {
editingFilt.setKey(null);
... | 5 |
public void CostEstimate(int []vshape,int []pshape,Vector<int[]> shapes, int []start, int []off) throws IOException, WrongArgumentException
{
DataChunk chunk = new DataChunk(vshape,pshape);
Set<DataChunk> chunks = chunk.getAdjacentChunks(start, off);
int rsize = 1;
for(int i = 0 ; i < start.length; i++)
... | 9 |
private void drawContentGrid(Graphics g) {
for (int i = 0; i < nbRows; i++) {
for (int j = 0; j < nbColumns; j++) {
visitor.setPosition(i, j);
grid[i][j].accept(visitor);
}
}
} | 2 |
private void beginTournamentButtonActionPerformed(java.awt.event.ActionEvent evt) {
tourn = new Tournament(brains, worlds);
tourn.startNewTourn(gui);
} | 0 |
@Override
public final String toString() {
StringBuffer toReturn = new StringBuffer();
switch (this.type) {
case DEFAULT_VALUATION: break;
case PRECOND_VALUATION:
if (this.variable != null) { toReturn.append(this.variable).append(" = "); }
toReturn.append("<").append(this.identifier);
toReturn.a... | 8 |
void hookListeners (Widget widget) {
if (logging) {
Listener listener = new Listener() {
public void handleEvent (Event event) {
log (event);
}
};
for (int i = 0; i < EVENT_INFO.length; i++) {
if (eventsFilter [i]) {
widget.addListener (EVENT_INFO[i].type, listener);
}
}
}
} | 3 |
public Document getDocument() {return this.doc;} | 0 |
public static Object getValueClass(char ch)
{
switch (ch)
{
case '@':
return PatternOptionBuilder.OBJECT_VALUE;
case ':':
return PatternOptionBuilder.STRING_VALUE;
case '%':
return PatternOptionBuilder.NUMBER_VALUE;
... | 9 |
public int doFSK200500_8000FFT (CircularDataBuffer circBuf,WaveData waveData,int start,int ss) {
// Get the data from the circular buffer
double datao[]=circBuf.extractDataDouble(start,ss);
double datar[]=new double[FFT_64_SIZE];
int a;
for (a=0;a<datar.length;a++) {
if ((a>=12)&&(a<52)) dat... | 3 |
public Iterator<City> iterator(){
return cityList.iterator();
} | 0 |
public List<List<Object>> cutLeaderboard(List<List<Object>> listToCut) {
int cutOff = this.n;
int listSize = listToCut.size();
List<List<Object>> listToReturn;
if (cutOff < listSize - 1) {
int lowestScore = (Integer) listToCut.get(cutOff - 1).get(0);
while (cutOf... | 5 |
private String httpGET(String requestURL) {
//Variables
URL request = null;
HttpURLConnection connection = null;
//Scanner scanner = null;
BufferedReader reader = null;
String s = "";
String response = "";
try {
request = new URL(requestURL);
connection = (HttpURLConnection) request.openConnecti... | 8 |
public boolean connect(){
try {
socket = new Socket(hostName, port);
input = new InputListener(this, socket.getInputStream());
input.start();
output = new OutputWriter(this, socket.getOutputStream());
output.start();
output.write("NICK " + nick + "\r\n");
//output.flush();
output... | 2 |
public static boolean CheckKingThreat(ChessPieceBase[][] TheBoard, boolean WhiteMove){
int KingLocationX=0,KingLocationY=0;
for (int a=0;a<8;a++){
for (int b=0;b<8;b++){
if (TheBoard[a][b]instanceof KingPiece&& TheBoard[a][b].isWhite==WhiteMove){
KingLocat... | 8 |
private JSONWriter append(String string) throws JSONException {
if (string == null) {
throw new JSONException("Null pointer");
}
if (this.mode == 'o' || this.mode == 'a') {
try {
if (this.comma && this.mode == 'a') {
this.writer.write(',');
}
this.writer.write(string);
} catch (IOExcepti... | 7 |
@Override
protected Dimension getSizeSelf(LayoutSize type) {
Dimension[] sizes = getChildSizes(type);
Dimension size = new Dimension(getHorizontalGap() * (sizes.length > 0 ? sizes.length - 1 : 0), 0);
for (Dimension one : sizes) {
size.width += one.width;
if (one.height > size.height) {
size.height = o... | 3 |
public boolean maisDeUmEmS() {
boolean res = false;
if (lockS.size() > 1) {
res = true;
}
return res;
} | 1 |
public void run() {
while(true) {
DatagramPacket packet=null; //ݱUDPĴ
byte data[]=weather.getBytes(); //ֽ
packet=new DatagramPacket(data,data.length,iaddress,port); //ָݰڴĿռʹСݰĿַ˿
System.out.println(new String(data));
try {
socket.send(packet);
sleep(3000);
}catch(Exception e){
e.prin... | 2 |
public void run() {
/*
* ゲームループ
*/
long beforeTime, afterTime, timeDiff, sleepTime;
long overSleepTime = 0L;
int noDelays = 0;
beforeTime = System.nanoTime();
prevCalcTime = beforeTime;
running = true;
while (running) {
gameUpdate();
gameRender();
paintScreen();
afterTime = System.... | 4 |
* */
public void restore(final Dockable dockable) {
if (dockable.getDockKey().getLocation() != DockableState.Location.MAXIMIZED) {
// development error (could have been an assertion).
throw new IllegalArgumentException(
"Dockable isn't currently in the MAXIMIZED state : "
+ dockable);
}
Dockab... | 7 |
@Override
public boolean tick(Tickable ticking, int tickID)
{
if((unInvoked)&&(canBeUninvoked()))
return false;
if((tickID==Tickable.TICKID_TRAP_DESTRUCTION)
&&(canBeUninvoked())
&&(pit!=null)
&&(pit.size()>1)
&&(((pit.get(0).numPCInhabitants()>0)
||(pit.get(pit.size()-1).numPCInhabitants()>0))))
... | 8 |
public boolean equals(Object o) {
if (o instanceof Key) {
Key k = (Key) o;
return tag == k.tag && intData == k.intData
&& objData.equals(k.objData);
}
return false;
} | 3 |
public void paint(Graphics g) {
super.paint(g);
if(!started) {Font small = new Font("Helvetica", Font.ROMAN_BASELINE, 20);
FontMetrics metr = g.getFontMetrics(small);
String msg = "PRESS SPACE";
g.setColor(new Color(255, 255, 255));
g.setFont(small);
g.drawString... | 7 |
public static void handleLabel(Transition transition, Automaton automaton) {
/*
* FSATransition trans = (FSATransition) transition; String label =
* trans.getLabel(); String firstChar = label.substring(0,1); String
* restOfLabel = label.substring(1);
*
* StatePlacer sp = new StatePlacer();
*
* ... | 2 |
public static int maxArea(int[] height) {
int low = 0, high = height.length - 1;
int maxarea = 0;
while (low < high) {
int w = height[high] > height[low] ? height[low] : height[high];
int area = w * (high - low);
maxarea = maxarea > area ? maxarea : area;
if (... | 4 |
public void ajoutEquipement()
{
JFileChooser fc = new JFileChooser("./jars/equipements");
int returnVal = fc.showOpenDialog(this);
if(returnVal == JFileChooser.APPROVE_OPTION)
{
File file = fc.getSelectedFile();
try
{
AEquipement eq... | 9 |
private void dbgPath(Graphics grphcs){
dbgString("update in: " + pathTime, grphcs);
dbgString("last update time: " + level.getLastPathUpdateDuration(), grphcs);
PathingGraph graph = level.getPathingGraph(debugPathing);
double rad = 0.1f;
double transformedDiameter = transformLength(2f * rad);
for(PointI p:g... | 5 |
public Instruction() {} | 0 |
public static void next() {
try {
if(currentPlayback != null && nextTrack != null) {
server.onTrackChange();
setCurrentTrack(nextTrack);
play();
}
} catch (MediaException e) {
System.out.println("Invalid media type.");
... | 3 |
public static Double grandDaddy(Double freeEnergy, Double enthalpy, Double temperature, Double entropy)
{
boolean[] nulls = new boolean[4];
nulls[0] = (freeEnergy == null);
nulls[1] = (enthalpy == null);
nulls[2] = (temperature == null);
nulls[3] = (entropy == null);
int nullCount = 0;
for(int k = 0; ... | 7 |
public List<FrameAdapter> getLateReceivers() {
ArrayList<FrameAdapter> result = new ArrayList<FrameAdapter>();
for (AuthFrameAdapter adapter : server.getAdapters()) {
if (adapter.isAuthenticated() && adapter.getSessionID() != sender && !receiverList
.contains(adapter.getSessionID())) {
result.add(adapte... | 4 |
public int mergeAdjacentFace(HalfEdge hedgeAdj, Face[] discarded) {
Face oppFace = hedgeAdj.oppositeFace();
int numDiscarded = 0;
discarded[numDiscarded++] = oppFace;
oppFace.mark = DELETED;
HalfEdge hedgeOpp = hedgeAdj.getOpposite();
HalfEdge hedgeAdjPrev = hedgeAdj.p... | 6 |
public String stats(){
int rAntsFood = 0;
int bAntsFood = 0;
for(int x = 0; x<world.getRows(); x++){
for(int y = 0; y<world.getColumns(); y++){
Cell c = world.getCell(x,y);
if(c.getIsRAntHill()){
rAntsFood += c.getFoodAmount();
}
else if(c.getIsBAntHill()){
bAntsFood += c.getFoodAmoun... | 6 |
public static void main(String[] args) {
try { test1(); }
catch (ArithmeticException e) { e.printStackTrace(); }
StdOut.println("--------------------------------");
try { test2(); }
catch (ArithmeticExc... | 8 |
private void setSerialPortParams() {
try {
serialPort.setSerialPortParams(
Integer.parseInt(baudComboBox.getSelectedItem().toString()),
SerialPort.DATABITS_8,
SerialPort.STOPBITS_1,
SerialPort.PARITY_NONE);
}
catch (Num... | 1 |
public boolean skipPast(String to) throws JSONException {
boolean b;
char c;
int i;
int j;
int offset = 0;
int length = to.length();
char[] circle = new char[length];
/*
* First fill the circle buffer with as many characters as are in the
... | 9 |
public static boolean isListAPalindrome(sNode head){
//If were using doubly linked lists we would first figure out the length then accordingly from the middle
//expand to both ends and compare values. This will be done O(n)
//However given that this we only have a singly linked list, we would f... | 6 |
private void armHealthyPopulation() {
int weapons, bulletsPerWeapon;
HumanInformation humanInformation;
//Calculate the number of healthy humans to give a weapon
weapons = Math.min(this.healthyCount, this.configuration.getResources().getWeapon().getArmedPerWeaponKit());... | 6 |
@Override
public String getFromNative(long i)
{
short strLen = stringLengths.getShort(i);
if (strLen < 0) return null;
long offset = sizeof * i * maxStringLength * CHARSET_SIZE;
for (int j = 0; j < strLen; j++) {
byteArray[j] = Utilities.UNSAFE.getByte(ptr + offset + ... | 3 |
public static void initDatabase(){
File dbFile = new File(DATABASE_FILE);
if(dbFile.exists()){
System.out.println("Warning! Database already exists! To delete, please run resetDatabase()");
return;
}
try {
Class.forName("org.sqlite.JDBC");
... | 3 |
@Override
public boolean isDataFlavorSupported(DataFlavor flavor) {
return (
flavor.equals(flavors[STRING]) ||
flavor.equals(flavors[NODESET])
);
} | 1 |
public void calculateValue() {
HashMap<Integer, Double> featuresVector = getVector();
value = 0;
for (int key : featuresVector.keySet()) {
value += Math.pow(featuresVector.get(key), 2);
}
value = Math.sqrt(value);
} | 1 |
public <T extends AstronomicalObject> String stringInnerObjects(Class<T> type) {
String returnedString = "";
if (type.getName().contains("SpacePort")) {
List<SpacePort> obj = spacePorts;
for (SpacePort t : obj) {
returnedString += t.deepToString();
}
... | 2 |
@Override
public String toString()
{
StringBuffer ret = new StringBuffer("TITLE: " + getTitle() + "\n");
try
{
ret.append("LABEL: " + getLabels() + "\n");
ret.append("FORMAT: " + getFormat() + "\n");
ret.append("TYPE: " + getReleaseType() + "\n");
ret.append("... | 2 |
public void wdgmsg(Widget sender, String msg, Object... args) {
if (sender == in) {
if (msg == "activate") {
wdgmsg("msg", args[0]);
in.settext("");
return;
}
}
super.wdgmsg(sender, msg, args);
} | 2 |
@Override
public Writer addRecordEntry(final String columnName, final Object value) {
if (rowMap == null) {
rowMap = new HashMap<String, Object>();
}
if (!validateColumnTitle(columnName)) {
throw new IllegalArgumentException("unknown column: \"" + columnName + "\"");... | 2 |
public void run(){
try{
InputStreamReader isr = new InputStreamReader(is);
BufferedReader br = new BufferedReader(isr);
String line = null;
if (type.equals("ERROR")){
while ((line = br.readLine()) != null){
System.out.... | 5 |
private RenderableObject generateImage(Scanner inFile) {
Point loc = null;
String f = "";
String current = inFile.next();
while (inFile.hasNext()
&& !(isCloseTag(current) && parseTag(current) == LegalTag.Object)) {
if (isOpenTag(current)) {
switch (parseTag(current)) {
case Location:
loc = n... | 6 |
public void setType(Type type)
{
this.type = type;
} | 0 |
public static Figure fromChar(char spec) {
switch (spec) {
case 'a':
case 'A':
return ASTERIX;
case 'o':
case 'O':
return OBELIX;
case 'm':
case 'M':
return MIRACULIX;
case 'l':
case 'L':
return LEGIONAIRE;
default:
throw new RuntimeException("Unknown spec: " + spec);
}
} | 8 |
private static String getHTML(String text) {
String urlToRead = "http://dictionary.yandex.net/dicservice.json/lookup?callback=ya_.json.c(11)&ui=ru&text="+text+"&lang=en-ru&flags=1&sid=546092b1";
URL url;
HttpURLConnection conn;
BufferedReader rd;
String line;
String resul... | 2 |
private void updateStateLocation(List<Keyword> keywords, List<String> terms) {
// assume that we are in canteen adennauerring, others can't be implemented because of lack of infomations
String[] lines = {"one", "two", "three", "four", "five", "six"};
String ln = null;
if(terms.get(0).contains("line")) {
String... | 9 |
public void setMapPoint(double latitude, double longtitude, double width, double height)
{
markerRect = new MarkerRect(longtitude,latitude,width,height);
MapGetter.setGoogleMarkers(markerRect);
MapGetter.getMapImage(MapGetter.createUrl(0, 0));
repaint();
} | 0 |
private byte[] crypt_raw(byte password[], byte salt[], int log_rounds) {
int rounds, i, j;
int cdata[] = (int[])bf_crypt_ciphertext.clone();
int clen = cdata.length;
byte ret[];
if (log_rounds < 4 || log_rounds > 31)
throw new IllegalArgumentException ("Bad number of rounds");
rounds = 1 << log_rounds;
... | 7 |
public int countMaxMovesLeft() {
if (infiniteGameTree) {
return 100;
}
switch (state) {
case 'A':
return 3;
case 'B':
return 2;
case 'C':
return 2;
case 'D':
return 1;
case 'E':
return 1;
case 'F':
return 1;
case 'G':
return 1;
case 'R':
return 1;
}
r... | 9 |
protected static Ptg calcGCD( Ptg[] operands )
{
if( operands.length < 1 )
{
return PtgCalculator.getNAError();
}
Ptg[] numbers = PtgCalculator.getAllComponents( operands );
long gcd = 0;
try
{
long n1;
if( (n1 = PtgCalculator.getLongValue( numbers[0] )) < 0 )
{
return new PtgErr( PtgErr.... | 6 |
@Override
public void connectToService() {
if (System.getSecurityManager() == null) {
System.setSecurityManager(new RMISecurityManager());
}
try {
Remote service = Naming.lookup("//127.0.0.1:1699/quiz");
quizService = (QuizService) service;
} catc... | 4 |
public void remove()
{ int i=EN-1;
if (EN<0) return;
O[i]=null; ON--;
if (Gap<0 || Gap>i) Gap=i;
if (i==OLast-1) OLast--;
while (OLast>0 && O[OLast-1]==null) OLast--;
if (Gap>=OLast) Gap=-1;
} | 7 |
public int getInventorySlot(int x,int y){
int totalSlots = player.getInventorySize();
//needed so that it draws in the right position. Placeholder.
int offsetY = 285;
int offsetX = 52;
for(int i = 0; i<totalSlots;i++){
//if the mouse is in the x bounds of one of the inventory slots
if(x > inventory... | 5 |
public static int discrete(double[] a) {
double EPSILON = 1E-14;
double sum = 0.0;
for (int i = 0; i < a.length; i++) {
if (!(a[i] >= 0.0)) throw new IllegalArgumentException("array entry " + i + " must be nonnegative: " + a[i]);
sum = sum + a[i];
}
if (su... | 7 |
@Override
public void actionPerformed(ActionEvent e) {
if (e.getSource()==subsectionButton1) {//add a question
ChooseQuestionsPanel chooseQuestionsPanel=new ChooseQuestionsPanel((SubsectionPanel)this);
chooseQuestionsPanel.setVisible(true);
}if (e.getSource()==subsectionButto... | 2 |
private void killPlayer(String filename)
{
synchronized(this) {
if(musicPlayer != null && filename.contains("music/")) {
musicPlayer.stop();
musicPlayer = null;
}
else if(soundPlayer != null && filename.contains("sounds/")) {
s... | 4 |
public synchronized static void timeAppendTextPane(Color color, String message, JTextPane box)
{
//Autodo it and build it like normal
StyledDocument doc = box.getStyledDocument();
Style style = box.addStyle("style", null);
StyleConstants.setForeground(style, color);
box.setCa... | 2 |
public void close(){
try{
this.fileChannel.close();
this.fileOutputStream.close();
}catch(Exception e){
e.printStackTrace();
try{
this.fileChannel.close();
this.fileOutputStream.close();
}catch(Exception e1){
e1.printStackTrace();
}
}
} | 2 |
@Test
public void MaaliEste() {
assertTrue("Este oli väärän tyyppinen",
t.onkoPisteessaEste(new Piste(350, 350)) == EsteenTyyppi.MAALI);
} | 0 |
List<PlayerQuizInstance> determineQuizWinner(List<PlayerQuizInstance> quizPlayInstances) {
PlayerQuizInstance maxScore = null;
List<PlayerQuizInstance> winners = new ArrayList<PlayerQuizInstance>();
if (quizPlayInstances.isEmpty()) {
return winners;
}
maxScore = Colle... | 5 |
public static void main(String[] args) throws InterruptedException
{
Training[] mytn = new Training[1000];
Semaphore mutex = new Semaphore(1);
for(int i=0; i < mytn.length; i++)
{
mytn[i] = new Training(mutex);
mytn[i].start();
}
for(int i=0; i < mytn.length; i++)
{
mytn[i].join();
}
Sys... | 2 |
static public ArrayList<Integer> MostFrequentInt (ArrayList<Integer> input) {
Hashtable<Integer,Integer> table = new Hashtable<Integer,Integer>();
ArrayList<Integer> result = new ArrayList<Integer>();
if (input.size() == 0)
return result;
for(Integer i:input) {
if (table.containsKey(i))
table.pu... | 5 |
@Override
public int attack(double agility, double luck) {
if(random.nextInt(100) < luck)
{
System.out.println("I just sacrified that monster!");
return random.nextInt((int) agility) * 4;
}
return 0;
} | 1 |
public void remove() { throw new UnsupportedOperationException(); } | 0 |
public void updateTable() {
System.out.println("Row: " + tableCheckin.getRowCount());
System.out.println("Col: " + tableCheckin.getColumnCount());
for (int row = 0; row < tableCheckin.getRowCount(); row++) {
for (int col = 0; col < tableCheckin.getColumnCount(); col++) {
getCheckinModel().setValueAt(null, ... | 7 |
public Map<String,Integer> bag_of_words(){
//System.out.println("=======================");
HashMap<String,Integer> bag = new HashMap<String,Integer>();
for(java.util.Map.Entry<String, String> entry : this.entrySet()){
if(entry.getKey()=="Name" ||
entry.getKey()=="Birthday"
)
cont... | 5 |
public boolean skipPast(String to) throws JSONException {
boolean b;
char c;
int i;
int j;
int offset = 0;
int length = to.length();
char[] circle = new char[length];
/*
* First fill the circle buffer with as many characters as are in the
... | 9 |
public LinkInfo setLocalBasePath(String s) {
if (s == null) return this;
localBasePath = s;
if (vid == null) vid = new VolumeID();
lif.setVolumeIDAndLocalBasePath();
return this;
} | 2 |
private Vector find_smallest_zones(
Vector zone_list,
int start,
int length)
{
if(zone_list == null)
{
zone_list = new Vector();
}
else
{
zone_list.setSize(0);
}
int end = start + length;
start = skipSpaces(textByteArray, start, length);
end = f... | 8 |
public static Tile getNewTileFromColor(int color) {
Tile tile = null;
switch (color) {
case SandTile.COLOR:
tile = new SandTile();
break;
case UnbreakableRailTile.COLOR:
tile = new UnbreakableRailTile(new FloorTile());
break;
case UnpassableSandTile.COLOR:
tile = new UnpassableSandT... | 7 |
public void push(int in) {
if (!isEmpty() && in > top()) {
++totalRejected;
} else {
super.push(in);
}
} | 2 |
@EventHandler
public void EndermanHeal(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.getEndermanConfig().getDouble("Enderman.Heal... | 6 |
public static boolean isCached(String name) {
if (cache.containsKey(name))
return true;
return false;
} | 1 |
private void updateStateTellWholeRecipe(List<Keyword> keywords,
List<String> terms) {
//If we came here due to a keyword, there should be a recipe keyword, or the recipe has been set
if (keywords != null && !keywords.isEmpty()) {
for (Keyword kw : keywords) {
if (kw.getKeywordData().getType().equals((KeywordTy... | 6 |
public Behaviour jobFor(Actor actor) {
if (! structure.intact()) return null ;
if (numPatients() == 0 && ! personnel.onShift(actor)) return null ;
final Choice choice = new Choice(actor) ;
//
// Manufacture Stim Kits for later use-
final Manufacture mS = stocks.nextManufacture(actor, MEDICINE_T... | 9 |
public MOB getHighestLevelMOB(MOB meMOB, Vector<MOB> not)
{
if(meMOB==null)
return null;
final Room R=meMOB.location();
if(R==null)
return null;
int highestLevel=0;
MOB highestMOB=null;
final Set<MOB> H=meMOB.getGroupMembers(new HashSet<MOB>());
if(not!=null)
H.addAll(not);
for(int i=0;i<R.num... | 8 |
public CommandGroup addCommands(Command... command)
{
for(Command c : command)
{
if(c instanceof CommandGroup)
{
((CommandGroup)c).parent = this;
}
commands.add(c);
}
return this;
} | 2 |
int insertKeyRehash(char val, int index, int hash, byte state) {
// compute the double hash
final int length = _set.length;
int probe = 1 + (hash % (length - 2));
final int loopIndex = index;
int firstRemoved = -1;
/**
* Look u... | 9 |
public static boolean isBlank(String str) {
int strLen;
if (str == null || (strLen = str.length()) == 0) {
return true;
}
for (int i = 0; i < strLen; i++) {
if ((Character.isWhitespace(str.charAt(i)) == false)) {
return false;
}
}
return true;
} | 4 |
private static Integer castInt(Object o) {
if (o == null) {
return null;
} else if (o instanceof Byte) {
return (int) (Byte) o;
} else if (o instanceof Integer) {
return (Integer) o;
} else if (o instanceof Double) {
return (int) (double) (... | 6 |
public static void checkUserFolder() {
File f = new File(userFolderPath());
if (!f.exists() || !f.isDirectory()) {
f.mkdir();
}
f = new File(modulesFolderPath());
if (!f.exists() || !f.isDirectory()) {
f.mkdir();
}
} | 4 |
public static String base16ToStr(String bytes) {
if (StringUtil.isNullOrEmpty(bytes))
return "";
ByteArrayOutputStream baos = new ByteArrayOutputStream(bytes.length() / 2);
// 将每2位16进制整数组装成一个字节
for (int i = 0; i < bytes.length(); i += 2)
baos.write((HEX.indexOf(... | 2 |
public int getDirectionToward(Location target)
{
int dx = target.getCol() - getCol();
int dy = target.getRow() - getRow();
// y axis points opposite to mathematical orientation
int angle = (int) Math.toDegrees(Math.atan2(-dy, dx));
// mathematical angle is counterclockwise f... | 1 |
public static void commandAvatar(Player p, Command command) {
if (playersInAvatarState.contains(p)) {
if (command.getName().equalsIgnoreCase("airBend")) {
//airBend(p);
}
if (command.getName().equalsIgnoreCase("earthBend")) {
earthBend(p);
}
if (command.getName().equalsIgnoreCase("metalBend")) {... | 7 |
@Override
public void addMedicine(MedicineDTO medicine) throws SQLException {
Session session = null;
try {
session = HibernateUtil.getSessionFactory().openSession();
session.beginTransaction();
session.save(medicine);
session.getTransaction().commit()... | 3 |
private void piirraTausta(Graphics graphics) {
/**
* Ao. yhtälöissä jakolasku johtuu siitä että halajamme viivoihin mageen
* parallaksiefektin.
*
* Ja jooooo for-loopin pituus on kovakoodattu, eli jos pelaaja menee
* tarpeeksi kauas vasemmalle, oikealle, ylös tai ala... | 3 |
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.