text stringlengths 14 410k | label int32 0 9 |
|---|---|
public Writer write(Writer writer) throws JSONException {
try {
boolean commanate = false;
Iterator keys = this.keys();
writer.write('{');
while (keys.hasNext()) {
if (commanate) {
writer.write(',');
}
... | 5 |
public void synchonizeDefaultMenuItem() {
OutlinerSubMenuItem openMenu = (OutlinerSubMenuItem) GUITreeLoader.reg.get(GUITreeComponentRegistry.OPEN_MENU_ITEM);
OpenFileMenuItem openMenuItem = (OpenFileMenuItem) openMenu.getItem(0);
openMenuItem.setProtocol(getDefault());
OutlinerSubMenuItem importMenu = (Outl... | 0 |
private static String generateKey() {
Random r = new Random();
long maxNumber = 4294967295L;
long spaces = r.nextInt( 12 ) + 1;
int max = new Long( maxNumber / spaces ).intValue();
max = Math.abs( max );
int number = r.nextInt( max ) + 1;
long product = number * spaces;
String key = Long.toString( produ... | 4 |
private ItemSelectionListener global() {
return new ItemSelectionListener() {
@Override
public void itemSelectionChanged( ItemSelectionEvent event ) {
for( ItemSelectionListener listener : getListeners() ) {
listener.itemSelectionChanged( event );
}
}
};
} | 1 |
public StringPickerGenerator(String tableName, String columnName, List<String> alternatives) {
super(tableName, columnName);
this.alternatives = alternatives;
} | 0 |
final void method3954(int i, Class310_Sub2 class310_sub2) {
method3956((byte) -56, class310_sub2);
if (aBooleanArray9786[((DirectxToolkit) this).anInt8175]
== !((Class310_Sub2) class310_sub2).aBoolean6334) {
((DirectxToolkit) this).anIDirect3DDevice9810.SetSamplerState
(((DirectxToolki... | 5 |
public ConfigFile()
{
//initialize hashtable
configSections = new Hashtable();
//read the config file
ReadConfigFile();
} | 0 |
public void sendtoserver(String s) {
String title = "[pvpϵͳ]";
this.log.info(title + s);
} | 0 |
public static Secteur selectOne(EntityManager em, String code_sec) throws PersistenceException {
Secteur unSecteur = null;
unSecteur = em.find(Secteur.class, code_sec);
return unSecteur;
} | 0 |
@Test
public void emptyResultsIfGettersOutOfBounds()
{
setupHighScoreTest();
assertTrue(high.getNameByRank(-1).equals("") &&
high.getScoreByRank(-1) == 0 &&
high.getNameByRank(3).equals("") &&
high.getScoreByRank(3) == 0);
} | 3 |
public <ObjectType, SpriteType extends Sprite<ObjectType>> SpriteType getSpriteOfTypeFor(
Class<SpriteType> type, ObjectType object) {
if (object == null) {
return null;
}
for (SpriteType sprite : getSpritesOfType(type)) {
if (object.equals(sprite.getObject())) {
return sprite;
}
}
return null... | 3 |
public static boolean NTfuncDef() throws IOException {
boolean success = true;
success = ErrorRecovery(NonTerminal.funcDef);
switch (lookahead) {
case ID:
case INTEGER:
case REAL:
if (!NTfuncHead())
success = false;
if (!NTfuncBody())
success = false;
if (!match(TokenType.SEMICOLON))
... | 7 |
public void reachableReference(Reference ref, boolean isVirtual) {
String clName = ref.getClazz();
if (clName.charAt(0) == '[')
/* Can't represent arrays */
return;
ClassIdentifier ident = getClassIdentifier(clName.substring(1,
clName.length() - 1).replace('/', '.'));
if (ident != null)
ident.reach... | 2 |
@Override
protected double valueMove(Move m, GameBoard board, int lookahead) {
if (m instanceof NoMove) return 0;
else if (m instanceof BuyDevCard) return 1;
else if (m instanceof ProposeTrade || m instanceof FulfillTrade) return 2;
else if (m instanceof BuildRoad) return 3;
else if (m instanceof BuildSettle... | 7 |
@Test
public void warandPeaceTest() throws Exception{
DLB dict = new DLB();
File warPeace = new File("warandpeace.txt");
StringTokenizer tk;
String str;
String nxt;
boolean allContained = true;
if(warPeace.isFile()){
BufferedReader wpReader = new B... | 8 |
public static Class getWrapper(Class primitive) {
if ( ! primitive.isPrimitive()) {
return primitive;
}
Class result = null;
if ( primitive.equals(int.class)) {
result = Integer.class;
} else if ( primitive.equals(long.class)) {
result = Long.c... | 9 |
public static String vectorCaddieDeletionToHTML(Vector<Caddie> rs){
if (rs.isEmpty())
return "";
String toReturn = "<TABLE BORDER='1' width=\"1000\">";
toReturn+="<CAPTION>Ces places ne sont pas réservables car la représentation a déjà eu lieu :</CAPTION>";
toReturn+="<TR>";
toReturn+="<TH> <i>Reservatio... | 2 |
public void moveTo(FATFolder newParent) throws IOException {
if (newParent == null)
throw new IllegalArgumentException("Bad new parent");
if (isRoot())
throw new IOException("Cannot move the root");
//only one move or delete at once
freeze();
try {
... | 9 |
public static int putMap(HashMap<String,String> map,String key, String value){
map = new HashMap<String,String>();
map.put(key, value);
counter_put++;
return counter_put;
} | 0 |
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
int n = scanner.nextInt();
int[] nums = new int[n];
for (int i = 0; i < n; i++) {
nums[i] = scanner.nextInt();
}
Arrays.sort(nums);
int minDiff = Integer.MAX_VALUE;
... | 5 |
public Track getTrack(String name) {
for(int x = 0; x<tracks.size(); x++) {
if(tracks.get(x).getName().matches(name))
return tracks.get(x);
}
return null;
} | 2 |
private void setNextObject() {
if (!iter.hasNext()) {
nextObject = null;
iter = null;
return;
}
Object o = iter.next();
try {
if (o instanceof File) {
File file = (File) o;
if (file.isDirectory()) {
ArrayList<Object> l = new... | 9 |
public InfoPanel() {
super(new BorderLayout());
Box verticalBox = Box.createVerticalBox();
Box center = Box.createHorizontalBox();
center.add(Box.createHorizontalGlue());
center.add(new JLabel(new ImageIcon(DataStorage.mainLogo.getImage().getScaledInstance(
DataS... | 7 |
private void btnEnterRecordActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnEnterRecordActionPerformed
foundIndex = NOT_FOUND;
partNo = this.txtNewProdNo.getText();
partDesc = this.txtNewProdDesc.getText();
try {
partPrice = Double.parseDouble(this.txtNe... | 5 |
public int findElement(int array[], int element)
{
int n = array.length;
if(n == 1)
return array[0];
int middle = (n-1)/2;
//best cases!
if(element == array[middle])
return array[middle];
if(n==2)
return array[n-1];
//search on RIGHT block : for(int i = middle+1; i <= n; i++)
... | 7 |
@Override
public boolean onCommand(CommandSender sender, Command cmd, String label,
String[] args) {
if(cmd.getName().equalsIgnoreCase("god")) {
if(sender instanceof Player) {
Player p = (Player) sender;
PlayerUtil pu = new PlayerUtil(p);
if(pu.hasPermission("Nostalgia.Command.god", PermissionType.... | 5 |
protected synchronized boolean broadcastMessage(Message msg){
if(msg == null)
return false;
msg.setSourceID(this.auctioneerID);
msg.setDestinationID(Message.TO_ALL_BIDDERS);
msg.setAuctionID(this.auctionID);
int tag = -1;
int nBidders = bidders.size();
if( msg instanceof Mess... | 5 |
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 |
public ObjektNode[] getChilds(ObjektNode paramObjektNode)
throws XmlRpcException, IOException
{
Vector localVector = (Vector)Client.getXmlRpcClient().execute("TreeHandler.getChilds",paramObjektNode.getParentId(), paramObjektNode.getArt().toString(), Boolean.valueOf(false), null, null);
ObjektNode[... | 1 |
@Override
public void sendUsageImpl(CommandSender sender) {
if (!(sender instanceof Player)) return;
sender.sendMessage(EdgeCore.usageColor + "/cash info");
sender.sendMessage(EdgeCore.usageColor + "/cash give <user> <amount>");
sender.sendMessage(EdgeCore.usageColor + "/cash donate <amount>");
User u ... | 3 |
@Override
public long put(long priority, int delaySeconds, int timeToRun, byte[] data) {
if (data == null) {
throw new BeanstalkException("null data");
}
if (priority > MAX_PRIORITY) {
throw new BeanstalkException("invalid priority");
}
long jobId = -1;
Request request = new Request("put " + priority... | 6 |
public String getSearchURLArgs()
{
_read.lock();
try
{
return _searchURLArgs;
}
finally
{
_read.unlock();
}
} | 0 |
public static void handleMouse(){
MouseEvent event;
int mx = Mouse.getEventX();
int my = Mouse.getEventY();
while(Mouse.next()){
if(Mouse.getEventButton() == 0){
if(Mouse.isButtonDown(0)){
if(game.duringPass){
for(Player p : game.getAllPlayers()){
if(p.getDisplay().getRect().contains... | 8 |
public List<MorrisIntersection> getNeighbor() {
List<MorrisIntersection> ret = new ArrayList<MorrisIntersection>();
if (hasLeft()) {
ret.add(left());
}
if (hasRight()) {
ret.add(right());
}
if (hasUp()) {
ret.add(up());
}
if (hasDown()) {
ret.add(down());
}
if (this.hasSkewLeftUp()) {
... | 8 |
String getMenuItemText(String item) {
boolean cascade = item.equals("Cascade");
boolean mnemonic = mnemonicsButton.getSelection();
boolean accelerator = acceleratorsButton.getSelection();
char acceleratorKey = item.charAt(0);
if (mnemonic && accelerator && !cascade) {
return ControlExample.getResourceStrin... | 6 |
public Address(String City, String Sector, String Calle, String HouseNumber,
String PostalCode, String country, String region) {
this.City = City;
this.Sector = Sector;
this.Calle = Calle;
this.HouseNumber = HouseNumber;
this.PostalCode = PostalCode;
this.country=country;
this.region="";
} | 0 |
public WeaponEditor(String name) {
setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
setTitle("Weapon Editor");
setBounds(100, 100, 600, 475);
getContentPane().setLayout(new BorderLayout());
contentPanel.setBorder(new EmptyBorder(5, 5, 5, 5));
getContentPane().add(contentPanel, BorderLayout.CENTER);
con... | 5 |
public void testWithField2() {
DateTime test = new DateTime(2004, 6, 9, 0, 0, 0, 0);
try {
test.withField(null, 6);
fail();
} catch (IllegalArgumentException ex) {}
} | 1 |
public static Calendar parseTimestamp(String timestamp) {
// Timestamp pattern
Pattern p1 = Pattern
.compile("\\w{3}, \\d{1,2} \\w{3} \\d{4} \\d{2}:\\d{2}:\\d{2} [+-]{1}\\w{4}");
Pattern p2 = Pattern
.compile("\\w{3}, \\d{1,2} \\w{3} \\d{4} \\d{2}:\\d{2}:\\d{2} \\w{3}[+-]{0,1}\\d{0,2}[:]{0,1}\\d{0,2}");
... | 8 |
public void initialize(String filePath){
_rawData = new LinkedList<String>();
patternEncoderUtil = new PatternEncoderUtil();
try {
fileReader = new FileReader(filePath);
_bufferedReader = new BufferedReader(fileReader);
while ((sCurrentLine = _bufferedReader.r... | 5 |
public CmdResetExecutor(SimpleQueues plugin) {
this.plugin = plugin;
} | 0 |
@Test
public void TestaaYlhaaltaAlasEste() {
rakentaja = new Kartanrakentaja(10, 6);
rakentaja.asetaEste(5, 3);
rakentaja.asetaEste(5, 4);
rakentaja.asetaEste(5, 2);
char[][] kartta = rakentaja.getKartta();
Solmu aloitus = new Solmu(0, 3);
Solmu maali = new So... | 5 |
public void paint1(Graphics g) {
//g.setColor(Color.RED);
//g.fillRect(0, 0, getWidth(), getHeight());
// Muestra en pantalla el cuadro actual de la animación
g.drawImage(background, 0, 0, this); // Imagen de background
if (pelota != null && pelota.getImagenI() != null) {
... | 7 |
@Override
public int[] getInts(int par1, int par2, int par3, int par4)
{
deepOcean = BiomeGenBase.deepOcean.biomeID;
mushroomIsland = BiomeGenBase.mushroomIsland.biomeID;
int i1 = par1 - 1;
int j1 = par2 - 1;
int k1 = par3 + 2;
int l1 = par4 + 2;
int[] ain... | 9 |
protected boolean verificarConvergencia() {
boolean converge = false;
for (int i = 0; i < this.matriz.linhas && !converge; i++) {
for (int j = i + 1; j < this.matriz.linhas && !converge; j++) {
converge = criterioLinhas();
if(!converge) {
trocarLinhas(i,j);
... | 5 |
public void omitLessFreq() {
if (name == null) return; // Illegal
int threshold = n_words[0] / LESS_FREQ_RATIO;
if (threshold < MINIMUM_FREQ) threshold = MINIMUM_FREQ;
Set<String> keys = freq.keySet();
int roman = 0;
for(Iterator<String> i = keys.iterator(); i.... | 8 |
public static void spawnPossessedItem (Location loc, int amount, ItemStack stack) {
int i = 0;
while (i < amount) {
Skeleton possessedItem = (Skeleton) loc.getWorld().spawnEntity(loc, EntityType.SKELETON);
possessedItem.addPotionEffect(new PotionEffect(PotionEffectType.FIRE_RESIS... | 1 |
private void insertFixup(Node z) {
while(z.parent.color == RED){
if(z.parent.equals(z.parent.parent.left)){
Node y = z.parent.parent.right;
if(y.color == RED){
z.parent.color = BLACK;
y.color = BLACK;
z.parent.parent.color = RED;
z = z.parent.parent;
}else{
if(z.equals(z.parent... | 6 |
private void BtGravarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_BtGravarActionPerformed
if (camposobrigatoriospreenchidos()) {
if (JOptionPane.showConfirmDialog(null, "Tem certeza que deseja realmente Gravar os dados deste fornecedor?", "Confirmar", JOptionPane.YES_NO_OPTION)... | 9 |
public int appendTo(StringBuilder sb, boolean tiny, boolean noneIfEmpty) {
int num = 0;
for (int i = 0; i < total.length; i++) {
int t = total[i];
if (t != 0) {
if (num++ > 0) {
sb.append(", ");
}
StatT stat = S... | 6 |
@SuppressWarnings("unchecked")
@Override
public void eSet(int featureID, Object newValue) {
switch (featureID) {
case statePackage.STATE__PLAYERS:
getPlayers().clear();
getPlayers().addAll((Collection<? extends Player>)newValue);
return;
case statePackage.STATE__COUNTRY_STATE:
((EStructuralFea... | 8 |
static void dradb2(int ido, int l1, float[] cc, float[] ch, float[] wa1,
int index){
int i, k, t0, t1, t2, t3, t4, t5, t6;
float ti2, tr2;
t0=l1*ido;
t1=0;
t2=0;
t3=(ido<<1)-1;
for(k=0; k<l1; k++){
ch[t1]=cc[t2]+cc[t3+t2];
ch[t1+t0]=cc[t2]-cc[t3+t2];
t2=(t1+=ido)<<1... | 7 |
public void sendBundledMessages(final Message[] buf, final int read_index, final int available_msgs) {
int max_bundle_size=transport.getMaxBundleSize();
byte[] cluster_name=transport.cluster_name.chars();
int start=read_index;
final int end=index(start + available_msgs-1);... | 7 |
public void method(String str) throws MyException,MyException1
{
if(null == str)
{
throw new MyException("传入的字符串参数不能为null");
}
else if("hello".equals(str))
{
throw new MyException1("输入的内容是:hello !");
}else
{
System.out.println(str);
}
} | 2 |
public void printMessages()
{
for (String s : list )
{
System.out.println(s);
}
} | 1 |
@Override
public boolean invoke(MOB mob, List<String> commands, Physical givenTarget, boolean auto, int asLevel)
{
Physical target=mob;
if((auto)&&(givenTarget!=null))
target=givenTarget;
if(target.fetchEffect(this.ID())!=null)
{
mob.tell(mob,target,null,L("<T-NAME> <T-IS-ARE> already affected by @x1.",... | 7 |
public static void newProcessingFormat(Object[] Fieldsin) {
//Filed(0) = Nombre de campo
//Field(s%4=0) = VariableComp1 = [X:|S:|C:|E:][N:|H:]NAME_op1
//Field(s%4=1) = operation = '==' '!=' '<' '>' '>=' '<='
//Field(s%4=2) = VariableComp2 = [X:|S:|C:|E:][N:|H:]NAME_op2
//Fiel... | 3 |
public ComputStdMethodDouble(double []v){
if (null == v || 0 == v.length){
mean = median = stddev = 0;
min = max = 0;
}else if (1 == v.length){
mean = median = stddev = v[0];
min = max = v[0];
}else{
double sum = v[0],sqSum=0;
min =v[0];
max = v[0];
for (int i=1;i<v.length;i++) {
... | 7 |
public void incluirNoInicio(ContaCorrente conta)
{
for (int i=this.capacidade - 2; i > 0; i ++)
this.aContas[i+1] = this.aContas[i];
this.aContas[0] = conta;
this.quantasContas ++;
} | 1 |
private TreeNode getSearchedNodes(String searchTxt) {
final DefaultMutableTreeNode master = new DefaultMutableTreeNode();
final Widget[] widgets = Widgets.getLoaded();
outer:
for (final Widget widget : widgets) {
if (widget.getChildrenCount() > 0) {
final WidgetChild[] children = widget.getChildren();
... | 7 |
public static boolean isPrime(int x) {
if (x == 2) {
return true;
}
if (x % 2 == 0 || x == 1) {
return false;
}
for (int i = 3; i * i <= Math.abs(x); i += 2) {
if (x % i == 0) {
return false;
}
}
return true;
} | 5 |
public static List<Integer> findTetrahedralChiralCenters(Molecule molecule) {
List<Integer> chiralCenterIndices = new ArrayList<Integer>();
MoleculeSignature molSig = new MoleculeSignature(molecule);
List<String> signatureStrings = molSig.getVertexSignatureStrings();
for (int i = 0; i < ... | 8 |
public java.awt.Component getTableCellEditorComponent(
javax.swing.JTable jtable,
Object value,
boolean isSelected,
... | 5 |
private void adjustBounds() {
if (mStorageCount > 0) {
Rectangle bounds = mStorage[0].getBounds();
mBounds.x = bounds.x;
mBounds.y = bounds.y;
mBounds.width = bounds.width;
mBounds.height = bounds.height;
for (int i = 1; i < mStorageCount; i++) {
mBounds.add(mStorage[i].getBounds());
}
} e... | 2 |
protected void compareDatasets(Instances data1, Instances data2)
throws Exception {
if (!data2.equalHeaders(data1)) {
throw new Exception("header has been modified\n" + data2.equalHeadersMsg(data1));
}
if (!(data2.numInstances() == data1.numInstances())) {
throw new Exception("number of instan... | 8 |
public static Stack<Point> getPath(Point home, Point size, ArrayList<Point> dirts, ArrayList<Point> bumps)
{
State cur = new State(home, null,new HashSet<Point>(dirts),new HashSet<Point>(bumps));
//Shearch for the path.
Stack<State> frontier = new Stack<State>();
HashSet<State> visited = new HashSet<State>(... | 9 |
static Gain parseGain(final int algorithmNumber, final byte[] gainParameters) throws ParseException {
Gain gain;
switch (algorithmNumber) {
case 0:
gain = null;
break;
case 1:
gain = ToneParser.parse(gainParameters);
... | 8 |
public void abortCommunication(final SubLWorker worker) throws IOException {
final Integer id = worker.getId();
if (id.intValue() < 0) {
//@note serial communications cannot be canceled right now
return;
}
try {
final String command = "(fif (" + "terminate-active-task-process"
... | 1 |
public static boolean isTruncatable(String num) {
for (int i = 1; i < num.length(); i++) {
if (!isPrime(Integer.parseInt(num.substring(0, i)))
|| !isPrime(Integer.parseInt(num.substring(i)))) {
return false;
}
}
return true;
} | 3 |
@Override
public void actionPerformed(ActionEvent e) {
if(e.getSource().equals(btnNextPanel1)){
cardLayout.show(frame.getContentPane(), "Panel2");
}
else if(e.getSource().equals(btnNextPanel2)){
cardLayout.show(frame.getContentPane(), "Panel3");
}else if(e.getSource().equals(btnNextPanel3)){
c... | 6 |
public AbbreviationAlignmentContainer<AbbvGapsHMM.Emissions, AbbvGapsHMM.States> findMostProbablePathBackwards(Acronym acronym){
int sPos = _sParam.getRangeEnd();
int lPos = _lParam.getRangeEnd();
int state = States.S.ordinal();
int stringPosS = -1;
int stringPosL = -1;
if(_evalMat.at(0, 0, States.S.ordi... | 5 |
public void setInstruments(int percusInstr) {
switch(percusInstr) {
case 0: // Rock
this.bass = "[acoustic_bass_drum]";
this.snare = "[acoustic_snare]";
this.openHiHat = "[open_hi_hat]";
this.closedHiHat = "[closed_hi_hat]";
this.hiTom = "[hi_tom]";
this.hiMidTom = "[hi_mid_tom]";
this.... | 4 |
public Element handle(FreeColServer server, Player player,
Connection connection) {
ServerPlayer serverPlayer = server.getPlayer(connection);
Unit carrier;
try {
carrier = player.getFreeColGameObject(carrierId, Unit.class);
} catch (Exception e) {
... | 7 |
public void setResultFilePath(String resultFilePath) {
this.resultFilePath = resultFilePath;
} | 0 |
private boolean roomIconClicked(Point mousePos){
for(int i = 0;i<rooms.size();i++){
if(
mousePos.x > getRoomIconPos(i).x &&
mousePos.x < getRoomIconPos(i).x+rooms.get(i).getIconSize().x &&
mousePos.y > getRoomIconPos(i).y &&
mousePos.y < getRoomIconPos(i).y+rooms.get(i).getIco... | 5 |
protected int[] besterZug(int[] aktuellePosition,
ArrayList<int[]> moeglicheZuege, String[][] spielfeld) {
int[] zielPosition = getAktuelleZielPosition(spielfeld);
double aktuellerAbstand = berechneAbstand(aktuellePosition,
zielPosition);
int[] bestePosition = { aktuellePosition[0], aktuellePosition[1] };
... | 6 |
public void gameLoop() {
long lastTick = System.nanoTime();
while (true) {
try { Thread.sleep(4); } catch (Exception e) {}; // pause a bit so that we don't choke the system
double deltaTime = (double)(System.nanoTime() - lastTick) / 1_000_000_000.0;
lastTick = System.nanoTime();
// Update multiple times... | 4 |
public List<String> listServerIds() throws Exception
{
CloudStackApiClient client = new CloudStackApiClient(LIST_VIRTUALMACHINE, apiKey, secretKey, apiUrl);
String response = client.execute();
if (containsErrorMessage(response))
{
throw new Exception("Error retrieving Servers. Response:" + getErrorMessage(... | 2 |
@Override
public String onAdvEvent(String event, L2Npc npc, L2PcInstance player)
{
String htmltext = "";
QuestState st = player.getQuestState(qn);
if (st != null && Util.isDigit(event))
{
int score = Integer.parseInt(event);
if (SCORES.containsKey(score))
{
int crystal = SCORES.get(score).getC... | 5 |
*/
public void centerVertical(FastVector nodes) {
// update undo stack
if (m_bNeedsUndoAction) {
addUndoAction(new centerVerticalAction(nodes));
}
int nMinX = -1;
int nMaxX = -1;
for (int iNode = 0; iNode < nodes.size(); iNode++) {
int nX = getPositionX((Integer) nodes.elementAt(iNode));
if (nX < ... | 7 |
public float arg() {
final float PI = (float)Math.PI;
if (x == 0) {
if(y < 0) {
return -PI/2;
} else if (y > 0) {
return PI/2;
}
throw new IllegalArgumentException("The argument of the zero vector is undefined.");
... | 6 |
public boolean hasStatus(UnitStatus.Type statusType) {
for (UnitStatus status : statuses) {
if (status.getType() == statusType) {
return true;
}
}
return false;
} | 2 |
@Override
public void run() {
long beforeTime, timeDiff, sleep;
beforeTime = System.currentTimeMillis();
while (gameLogic.getBase().getHealth() > 0) {
gameLogic.moveEnemies();
gameLogic.checkCollisions();
repaint();
timeDiff = System.currentTimeMillis() - beforeTime;
sleep = Definitions.simulation... | 3 |
public String getHumanPropValue(String name, String prop)
throws IOException {
if (name.isEmpty())
return null;
if (humanProp == null)
setHumanProp();
if (humanProp == null)
throw new NullPointerException();
LinkedHashMap<String, String> human = humanProp.getHuman(name);
if (human == null)
retu... | 4 |
public static void main(String[] args){
// Socket which will connect to the engine.
Socket socket = null;
// Reader to read packets from engine
BufferedReader inStream = null;
// Convenience wrapper to write back to engine
PrintWriter outStream = null;
// port number... | 7 |
private Image findGameElementImage(Element element) {
if (element instanceof IdentityDisc) {
return identitydisc;
} else if (element instanceof LightGrenade) {
if (!((LightGrenade) element).isActive()
&& !((LightGrenade) element).isExploded())
return lightgrenade;
}
return null;
} | 4 |
void output(int code, OutputStream outs) throws IOException {
cur_accum &= masks[cur_bits];
if (cur_bits > 0)
cur_accum |= (code << cur_bits);
else
cur_accum = code;
cur_bits += n_bits;
while (cur_bits >= 8) {
char_out((byte) (cur_accum & 0xff), outs);
cur_accum >>= 8;
cur_bits -= 8;
}
... | 8 |
@Override
public void setForeground(Color foregroundColor) {
assert foregroundColor != null;
if (this.foregroundColor != null && this.foregroundColor.getRGB().equals(foregroundColor.getRGB())) {
return;
}
super.setForeground(foregroundColor);
this.foregroundColor = foregroundColor;
} | 2 |
protected void paintFocus(Graphics g, AbstractButton b,
Rectangle viewRect, Rectangle textRect,
Rectangle iconRect)
{
boolean divider = b.getName() == null ? false :
b.getName().equals("dividerButton");
if(b.getModel().isPressed() || mouseOver ||... | 6 |
public Attacks removeMin() {
if ( _heap.size() == 0 )
return null;
//store root value for return at end of fxn
Attacks retVal = peekMin();
//store val about to be swapped into root
Attacks foo = _heap.get( _heap.size() - 1);
//swap last (rightmost, deepest) leaf with root
swap( 0, _heap.size() - 1 );
... | 4 |
public Deliver OnDeliver() {
if (this.LoginResult.ErrorCode == 0) {
return this.pconnect.OnDeliver();
} else {
return null;
}
} | 1 |
public void testInvalidObj() {
aDateTime = getADate("2000-01-01T00:00:00");
try {
cYear.compare("FreeBird", aDateTime);
fail("Invalid object failed");
} catch (IllegalArgumentException cce) {}
} | 1 |
void betting() throws Exception
{
System.out.println("Betting begins. ");
System.out.println("-----------------------------------------------");
System.out.println("Specify entry payment amount:");
int payment = sc.nextInt();
if (payment <= 0)
{
System.ou... | 6 |
@Override
public void run(){
StaticVar.countProcess++;
//需要增加while循环检测connectionTimeOut并作相应处理,使其重新连接
while(this.connectTime<=maxConnectTime){
try {
this.httpUrl=(HttpURLConnection)new URL(downloadWorker.getHttpDownload().getSrcUrl()).openConnection();
break;
} catch (IOException e) {
// TODO A... | 9 |
private void jButton21ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton21ActionPerformed
try {
if (jTable4.getSelectedRow() < 0) {
JOptionPane.showMessageDialog(this, "Please select server to delete", "Error", JOptionPane.ERROR_MESSAGE);
retur... | 4 |
private static void checkPanDigital(int[] indexes, HashMap<Integer, Integer> products) {
for (int split1 = 1; split1 < indexes.length - 1; split1++) {
for (int split2 = split1 + 1; split2 < indexes.length; split2++) {
StringBuilder sb1 = new StringBuilder();
for (int ... | 7 |
public int getRed(){
return _red;
} | 0 |
public Grammar getGrammar() {
return grammar;
} | 0 |
public void addComponentToPane(Container pane) {
// Set up the title image for reuse.
titleImage = null;
try {
titleImage = ImageIO.read(new File("src" + File.separator
+ "mentalpoker" + File.separator + "images"
+ File.separator + "title.png"));
} catch (IOException e) {
e.printStackTrace();
... | 2 |
public int getValV(String nodeID, String attr){
increaseAccess();
Node n = nodeMap.get(nodeID);
if (n != null){
Object val = n.getAttr(attr);
if(val != null && val instanceof Integer){
return (Integer)val;
}
}
return Integer.MAX_VALUE;
} | 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.