text stringlengths 14 410k | label int32 0 9 |
|---|---|
public ChartPanel BarChart(){
CategoryDataset dataset = getDataSet();
JFreeChart chart = ChartFactory.createBarChart3D(
"水果", // 图表标题
"水果种类", // 目录轴的显示标签
"数量", // 数值轴的显示标签
dataset, // 数据集
PlotOrientation.VERTICAL, // 图表方向:水平... | 0 |
public void injectLyrics(Path audioFilePath) {
AudioFile audioFile;
try {
audioFile = AudioFileIO.read(audioFilePath.toFile());
Tag audioFileTag = audioFile.getTag();
String lyrics = lyricWiki.getLyrics(audioFileTag.getFirst(FieldKey.ARTIST),
audioFileTag.getFirst(FieldKey.TITLE)).trim();
if(lyri... | 6 |
private ArithmeticResult funcCall(Block codeBlock) throws IOException, SyntaxFormatException {
if (checkCurrentType(TokenType.CALL)) {
moveToNextToken();
String funcName = lexer.getCurrentToken().getIdentifierName();
assertAndMoveNext(TokenType.IDENTIRIER);
ArrayList<ArithmeticResult> argumentList = new A... | 5 |
@SuppressWarnings("unchecked")
public final K[] decode(final String crypt) {
ArrayList<K> plain = new ArrayList<K>();
String code = "";
for (final Character c : crypt.toCharArray()) {
code += c;
K symbol = this.codes.get(code);
if (symbol!=null) {
plain.add(symbol);
code = "";
}
}
return ... | 2 |
public static void main(String[] args) {
ExecutorService executorService = Executors.newSingleThreadExecutor();
for (int i = 0; i < 10; i++) {
final int no = i;
Runnable runnable = new Runnable() {
@Override
public void run() {
... | 2 |
@Override
public synchronized K remove(Object arg0)
{
if (!map.containsKey(arg0))
return null;
final LinkedEntry<T, K> p = map.remove(arg0);
if (map.size() == 0)
{
head = null;
tail = null;
return p.second;
}
LinkedEntry<T, K> pn = p.next;
while ((pn != null) && (tail != pn))
{
pn.index... | 8 |
public String reverseVowels(String s) {
if(s==null || s.isEmpty()) return s;
StringBuilder sb=new StringBuilder(s);
List<Integer> list=new ArrayList<>();
for(int i=0;i<sb.length();++i){
if("aeiouAEIOU".contains(""+sb.charAt(i))){
list.add(i);
}
... | 5 |
private boolean synchronizeSockets() {
boolean changed = false;
List<ConnectorTag> newSocketTags = new ArrayList<ConnectorTag>();
for (ConnectorTag tag : socketTags) {
if (tag.getLabel() != null) {
this.remove(tag.getLabel().getJComponent());
}
}
for (int i = 0; i < getBlock().getNumSockets(); i++) ... | 9 |
public boolean setPlayerTurn(PlayerTurn turn) {
boolean test = false;
if (test || m_test) {
System.out.println("Game :: setPlayerTurn() BEGIN");
}
m_playerTurn = turn;
if (test || m_test) {
System.out.println("Game :: setPlayerTurn() END");
}
... | 4 |
public int hashCode() {
return super.hashCode() ^ myInputToRead.hashCode()
^ myStringToPop.hashCode() ^ myStringToPush.hashCode();
} | 0 |
public void createTower(int id, Player.PlayerType playerType, TowerTypes towerType, Point position) {
Tower tower = null;
switch(towerType){
case ATTACKTOWER:
tower = new AttackTower(id, TowerTypes.ATTACKTOWER.cost, position, playerType);
break;
case SUPPORTTOWER :
tower = new SupportTower(... | 8 |
public static boolean isMonospaced(FontMetrics fm) {
Font font = fm.getFont();
String mono = "Monospaced";
String family = "family";
Map<TextAttribute, ?> attributes = font.getAttributes();
if (attributes.containsValue(mono)) {
return true;
}
Set<TextAttribute> keySet = attributes.keySet();
for (Text... | 7 |
public static Class<?> findCommonElementType(Collection<?> collection) {
if (isEmpty(collection)) {
return null;
}
Class<?> candidate = null;
for (Object val : collection) {
if (val != null) {
if (candidate == null) {
candidate = val.getClass();
... | 8 |
public void add(SystemObject[] objects) throws ConfigurationChangeException {
if(checkChangePermit()) {
// wenn die Menge bereits aktiviert oder freigegeben wurde, dann darf nichts mehr geändert werden, es sei denn
// die Referenzierungsart ist "Gerichtete Assoziation", dann darf in der in Bearbeitung befindlic... | 7 |
@Override
public boolean equals(Object obj)//test each conditions work well
{
//boolean equals = false;
if(this.getClass()==obj.getClass())//determine whether the type is same or not.
{
if(this.seat.length ==((SeatChart)obj).seat.length )
{// because after determining, we can use cast here(we know it ... | 4 |
protected void initializeCommandTypeInfo()
{
super.initializeCommandTypeInfo();
Map mm7ArgumentTypeArrayByCommandTypeMap = super.getArgumentTypeArrayByCommandTypeMap();
Map mm7ArgumentTypeDisplayInfoArrayByCommandTypeMap = super.getArgumentTypeDisplayInfoArrayByCommandTypeMap();
... | 7 |
private void populateBirdsComboBox() {
birdsJComboBox.removeAllItems();
if(!birds.isEmpty()) {
for(int i = 0; i < birds.size(); i++) {
birdsJComboBox.addItem(birds.get(i).getName());
}
}
} | 2 |
private Preferences init() {
try {
List<String> langs = Utils.getResourceListing(Preferences.class.getClassLoader(), "/lang/");
langs.remove("/langs/languages.json");
if(!langs.contains("/lang/" + language + ".json")) {
String last = this.language;
for(String lang : langs)
if(lang.startsWith("... | 5 |
public String deletePoints(String ligne){
int i;
StringBuilder sb = new StringBuilder();
for(i=0;i<ligne.length();i++){
if(ligne.charAt(i) == '.'){
while(i+1<ligne.length() && ligne.charAt(i+1) == '.')
i++;
}
else
sb.append(ligne.charAt(i));
}
return sb.toString();
} | 4 |
private static int[] getEachMonoCharWidth(FontMetrics fm, String value) {
if (fm == null || value == null) {
return null;
}
int cnCharWidth = fm.charWidth('米');
int enCharWidth = fm.charWidth('M');
int length = value.length();
int[] result = new int[length];
int oneByteCharCodePoint = 0x7F;
for (int ... | 4 |
public void getWheelGraph(mxAnalysisGraph aGraph, int numVertices)
{
if (numVertices < 4)
{
throw new IllegalArgumentException();
}
mxGraph graph = aGraph.getGraph();
Object parent = graph.getDefaultParent();
Object[] vertices = new Object[numVertices];
for (int i = 0; i < numVertices; i++)
{
... | 4 |
private Object evaluateCellFormula(final XSSFWorkbook workbook, final Cell cell) {
FormulaEvaluator evaluator = workbook.getCreationHelper()
.createFormulaEvaluator();
CellValue cellValue = evaluator.evaluate(cell);
Object result = null;
if (cellValue.getCe... | 3 |
private boolean actualizarUsuario(Usuario u, String codigo, String nombre, String clave, String cargo) {
if (u.getCodigo().equals("1")) {
JOptionPane.showMessageDialog(this, "El código y cargo del usuario\nespecial 1(UNO) no se modificarán", "Administrador principal", JOptionPane.INFORMATION_MESSAGE... | 9 |
public void randDnaSeqGetBaseTest(int numTests, int numTestsPerSeq, int lenMask, long seed) {
Random rand = new Random(seed);
for( int t = 0; t < numTests; t++ ) {
String seq = "";
int len = (rand.nextInt() & lenMask) + 10; // Randomly select sequence length
seq = randSeq(len, rand); // Create a random se... | 3 |
public boolean EliminarProducto(Producto p){
if (p!=null) {
cx.Eliminar(p);
return true;
}else {
return false;
}
} | 1 |
public void close()
{
try {
//
for(Device d : devices)
d.close();
//
pool.shutdownNow();
//
running=false;
server.close();
//
device_monitor.interrupt();
device_monitor.join();
} catch (IOException e) {
e.printStackTrace();
} catch (InterruptedException e) {
e.printStackTr... | 3 |
private JButton getJButtonListar() {
if (jButtonListar == null) {
jButtonListar = new JButton();
jButtonListar.setBounds(new Rectangle(105, 330, 106, 31));
jButtonListar.setText("Listar");
jButtonListar.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.... | 9 |
private Slot getSlot(String name, int index, int accessType)
{
Slot slot;
// Query last access cache and check that it was not deleted.
lastAccessCheck:
{
slot = lastAccess;
if (name != null) {
if (name != slot.name)
break la... | 8 |
public MidiThread (){
File midiFile = new File(file_path); // Instantiates a File object
try {
// Create a new Sequencer Object with the Midi File
Sequence sequence = MidiSystem.getSequence(midiFile);
midiSequencer = MidiSystem.getSequencer();
midiSequencer.open();
... | 9 |
public void createShapeList(ShapeList sl, ImageMap imagemap)
throws Exception {
sl.clear();
Hashtable<String, ImageMap> maps = imagemap.getImagemaps();
addShapeList(sl, imagemap.getAreas());
// sl.set_mapName(imagemap.getName());
if (maps != null && maps.size() > 0) {
for (ImageMap map : maps.values()... | 3 |
private void checkRoyalFlush() {
int suit = hand[0].getSuit();
for (int i = 0; i < 5; i++) {
Card card = hand[i];
if (card.getSuit() != suit) {
break;
}
if (card.getValue() == (13 - i)) {
if (i == 4 && card.getValue() == 10) {
myEvaluation[0] = 10;
myEvaluation[1] = 1;
myEvaluatio... | 5 |
public PlanGolden(JSONObject help) throws FatalError {
super("Golden");
try {
this.medicine = help.getInt("Medizin");
} catch (JSONException r) {
}
} | 1 |
public static int digits(int numval)
{
if (numval < 10) return 1;
if (numval < 100) return 2;
if (numval < 1000) return 3;
if (numval < 10000) return 4;
if (numval < 100000) return 5;
if (numval < 1000000) return 6;
if (numval < 10000000) return 7;
if (numval < 100000000) return 8;
if (numval < 10000... | 9 |
@Override
MessageExoType getMessageExoType(String arrow) {
if (arrow.contains(">")) {
return MessageExoType.FROM_LEFT;
}
if (arrow.contains("<")) {
return MessageExoType.TO_LEFT;
}
if (arrow.startsWith("/") || arrow.startsWith("[/") || arrow.startsWith("\\") || arrow.startsWith("[\\")) {
return Mess... | 8 |
public void setAlgorithmParameters(AlgorithmParametersType value) {
this.algorithmParameters = value;
} | 0 |
protected void renameItem(final TreeItem item) {
boolean showBorder = true;
final TreeEditor editor = new TreeEditor(tree);
final Composite composite = new Composite(tree, SWT.NONE);
final Text text = new Text(composite, SWT.NONE);
final int inset = showBorder ? 1 : 0;
// NONO for syms and dirs
if (item.... | 9 |
@Override
public byte[] read(DataInputStream in, PassthroughConnection ptc, KillableThread thread, boolean serverToClient, DownlinkState linkState) {
setupBuffer(null);
int pos = 0;
while(pos < length) {
try {
pos += in.read(value, pos, length - pos);
} catch (SocketTimeoutException ste) {
if(!t... | 5 |
public String longestPalindrome(String s) {
if (s.isEmpty()) {
return null;
}
if (s.length() == 1) {
return s;
}
String longest = s.substring(0, 1);
for (int i = 0; i < s.length(); i++) {
// test [i]
String tmp = helper(s, i, i);
... | 5 |
@Override
public StatusType getInput(Object object) {
StatusType status = StatusType.PLAYING;
do {
try {
this.display(); //displays the display method from this class
//get the input command entered by user
String input = this.getCommand()... | 7 |
private boolean wagonHasToStop()
{
if(stoppingMarker == 850 && getY() == 550)
{
return true;
}
else if(stoppingMarker == 750 && getY() == 620)
{
return true;
}
else if (stoppingMarker == 650 && getY() == 690)
{
retur... | 6 |
public void run() {
try {
InputStream is = csocket.getInputStream();
OutputStream os = csocket.getOutputStream();
String ip = csocket.getInetAddress().getHostAddress();
InputStreamHandler_ass ish = new InputStreamHandler_ass(is, os,
list, csocket.getInetAddress().getHostAddress(), this);
ish.start... | 1 |
public ByteBuffer getBuffer(String filePath){
ByteBuffer buffer = fileMaps.get(filePath);
if(buffer == null){
File requestedFile = new File(filePath);
if(requestedFile != null && requestedFile.exists()){
FileInputStream fileInput = null;
FileChannel fileChannel = null;
try{
... | 8 |
@Override
public void drawGraphForm(FrameBuffer buffer, Camera camera) {
manGraphForm.refresh(camera);
manGraphForm.drawGraphForm(buffer);
} | 0 |
public Expr evaluate(IEvaluationContext context, Expr[] args)
throws ExprException {
assertArgCount(args, 4);
Expr ens = evalArg(context, args[0]);
if (!isNumber(ens))
return ExprError.VALUE;
int nums = ((ExprNumber) ens).intValue();
if (nums < 0)
... | 8 |
public void restart (){
this.log.setVisible(false);
this.setVisible(false);
getContentPane().removeAll();
this.board=new Board();
black=new Cpu(Board.BLACK,board);
turnChanger = new TurnChanger(new Player(Board.WHITE,board),black);
this.log=new LogWindow();
showBoard(true);
this.log.setVisible(true);
... | 0 |
private Rectangle computeCaretRect(int selRow, ST selType) {
Rectangle rect;
FontMetrics fm = painter.getFontMetrics(painter.getFont());
Insets i = painter.getInsets();
int gw = fm.getMaxAdvance(), gh = fm.getHeight();
if (selType == ST.RECT) {
rect = new Rectangle(1 + i.left + col * gw, // Po... | 4 |
private void calculateWordStatistics(TreeMap<String, String> descriptions2,
TreeMap<String, Integer> wordStats) {
for (String line : descriptions2.values()) {
String reformatted = Database.simplifyText(line);
String[] words = reformatted.split(" ");
for (String word : words) {
if (wordStats.containsKe... | 3 |
public void freeResources() {
if (stockImages != null) {
for (int i = 0; i < stockImages.length; ++i) {
final Image image = stockImages[i];
if (image != null) image.dispose();
}
stockImages = null;
}
if (iconCache != null) {
for (Enumeration it = iconCache.elements(); it.hasMoreElements(); ) {... | 8 |
public static Stella_Object getTokenText(Cons options) {
if (!Stella.insideWithTokenizerP()) {
{ Object old$PrintreadablyP$000 = Stella.$PRINTREADABLYp$.get();
try {
Native.setBooleanSpecial(Stella.$PRINTREADABLYp$, true);
Stella.signalTranslationError();
if (!(Stella.su... | 9 |
public void outHeapMin(ArrayList<Pair> priorityQueue) {
if (size(priorityQueue) > 3) {
int childIndex = 3;
Pair bottom = bottom(priorityQueue);
Pair grandChild2 = null;
Pair grandChild3 = null;
Pair grandChild4 = null;
if (size(priorityQueue) > 4) {
grandChild2 = priorityQueue.get(4);
if ... | 7 |
* @throws ConfigurationChangeException Falls das Objekt nicht vervollständigt werden konnte (Mengen und Datensätze konnten nicht hinzugefügt werden).
*/
private void completeImportObject(ImportObject importObject) throws ConfigurationChangeException {
// Eigenschafts-Objekt des zu importierenden Objekts
final Sy... | 8 |
public static void main(String[] args) {
int i = 1234567890;
float f = i;
System.out.println(i - (int) f); // -46
} | 0 |
protected Player getPlayer(Grid grid, int playerNr, Position pos) {
if (grid == null || pos == null || playerNr <= 0 || playerNr > getMaxNumberOfPlayers())
throw new IllegalArgumentException("The given arguments are invalid!");
return new Player(grid, playerNr, pos);
} | 4 |
boolean headerUpdateToolTip (int x) {
String tooltip = headerGetToolTip (x);
if (tooltip == null || tooltip.length () == 0) return false;
if (tooltip.equals (toolTipLabel.getText ())) return true;
toolTipLabel.setText (tooltip);
CTableColumn column = getOrderedColumns () [computeColumnIntersect (x, 0)];
toolTipS... | 5 |
private String getStackTrace() {
try {
// force an exception so you can inspect the stack trace
throw new ErrorReport("Error trace:");
} catch (ErrorReport e) { // catch the exception
// record the original stack trace
StackTraceElement[] ste = e.getStackTrace();
// copy only the relevant entries
... | 8 |
public final TLParser.powExpr_return powExpr() throws RecognitionException {
TLParser.powExpr_return retval = new TLParser.powExpr_return();
retval.start = input.LT(1);
Object root_0 = null;
Token char_literal127=null;
TLParser.unaryExpr_return unaryExpr126 = null;
TLP... | 4 |
public void populate(){
int e = 0;
for(int i=0;i<rand.nextInt(30)+1;i++){
e = rand.nextInt(EntityType.values().length-1);
while(e==6){
e = rand.nextInt(EntityType.values().length-1);
}
ents.add(new Entity(EntityType.values()[e],this));
... | 2 |
public static void main(String[] args) {
Map<CmpPoint, Integer> m = new HashMap<CmpPoint, Integer>();
CmpPoint p = new CmpPoint(0,2);
m.put(new CmpPoint(1,1), 1);
m.put(new CmpPoint(0, 2), 2);
m.put(new CmpPoint(2, 0), 3);
System.out.println(m.get(p));
} | 0 |
private DialogMessage(int icon)
{
switch(icon)
{
case 0: messageImage = new ImageIcon(this.getClass().getResource("/Resources/DialogPane/Tie.png"));
break;
case 1: messageImage = new ImageIcon(this.getClass().getResource("/Resources/DialogPane/PlayerOne.png")... | 3 |
public Expression negate() {
if (getOperatorIndex() == LOG_NOT_OP) {
if (subExpressions != null)
return subExpressions[0];
else
return new NopOperator(Type.tBoolean);
}
return super.negate();
} | 2 |
public Map<String, String> spaceParser(String[] argv) {
if( argv.length == 0){
info.printUsage("");
}
Map<String, String> map = new HashMap<String, String>();
// String[] entry;
int i = 0;
String myParam = null;
String myValue = null;
if //(Ar... | 8 |
public boolean getHeaderInfo() {
if (domain == null || domain.isEmpty())
return false;
try {
CloseableHttpClient httpclient = HttpClients.createDefault();
HttpGet httpGet = new HttpGet(domain);
CloseableHttpResponse response = httpclient.execute(httpGet);
Header[] headers = response.getAllHeaders();... | 4 |
public void mouseClicked(Point p){
if(rect.contains(p) && visible){
for(GuiComponent c: components){
c.mouseClicked(p);
}
}
} | 3 |
public boolean hasAbbArg() {
String s = peek();
if(s.isEmpty()) {
return false;
} else {
return s.length() == 2 && s.charAt(0) == '-' && Character.isLetter(s.charAt(1));
}
} | 3 |
private void releaseServiceWithoutCheck(BeanContextChild child,
BCSSChild bcssChild, Object requestor, Object service,
boolean callRevokedListener) {
if (bcssChild.serviceRecords == null
|| bcssChild.serviceRecords.isEmpty()) {
return;
}
sync... | 7 |
@Override
public void objectReceived(Object o) {
NetMessage n;
try {
n = NetMessage.parseFrom((byte[])o);
System.out.println(n.getType().toString() + " message received");
switch (n.getType()) {
case AUTHENTICATION:
authenticate(n);
break;
case REPLY:
acknowledge(n);
break;
cas... | 4 |
@Override
public void execute(CommandSender sender, String[] arg1) {
if (!CommandUtil.hasPermission(sender, PERMISSION_NODES)) {
sender.sendMessage(plugin.NO_PERMISSION);
return;
}
if (arg1.length < 1) {
sender.sendMessage(ChatColor.RED + "/" + plugin.cignore + " (player)");
return;
}
Proxied... | 4 |
private String getRule() {
String rule = "";
switch (cmbAlgorithme.getSelectedIndex()) {
case 0:
rule = "23/3";
break;
case 1:
rule = "23/36";
break;
case 2: // Random
Random rnd = new R... | 6 |
public void setValue(String value) {
this.value = value;
} | 0 |
public String getAxisName(int index) {
return axes.get(index).getName();
} | 0 |
@Override
public int overlap(DnaSequence seq1, DnaSequence seq2) {
// Initialize
bestScore = Integer.MAX_VALUE;
bestOffset = 0;
rotator = new SequenceRotator(seq1);
// Rotating right
int lenRight = seq2.length() - minOverlap + 1;
int lenLeft = seq1.length() - minOverlap + 1;
int len = Math.max(lenRigh... | 8 |
private void getGeoInfo(String geo) {
StringBuffer value= new StringBuffer();
for(char c:geo.toCharArray()){
if(c>45&&c<58){
value.append(c);
}
if(c==44){
if(value.length()>0){
latitude=Double.parseDouble(value.toString());
value.delete(0, value.length());
}
}
}
longitude=Doubl... | 5 |
public ParseResult parse(RSyntaxDocument doc, String style) {
Element root = doc.getDefaultRootElement();
int lineCount = root.getElementCount();
if (taskPattern==null ||
style==null || SyntaxConstants.SYNTAX_STYLE_NONE.equals(style)){
result.clearNotices();
result.setParsedLines(0, lineCount-1);
r... | 9 |
public void Asociar()
{
String[] ingles = new String[6];
String[] espaniol = new String[6];
int contadorIngles = 0;
int contadorEspaniol = 0;
String[] elemento = palabras.split(",");
int contador1 = 1;
contador = 0;
int n = elemento.length;
int i = 0;
//Creas las litas de palabras en espaniol e ing... | 6 |
@Override
public boolean isValid(Location loc) {
if (loc instanceof AdvancedLocation) {
switch (((AdvancedLocation) loc).getLayer()) {
case ActorLevel:
return super.isValid(loc);
case FloorLevel:
return this.mapGrid.isValid(... | 4 |
public static AWSCredentials loadKeys() throws IOException{
InputStream propertiesIS = TransferManager.class.getResourceAsStream(SAMPLES_PROPERTIES_NAME);
if(propertiesIS == null) {
throw new RuntimeException("Property file does not exist");
}
Properties properties = new Properties();
pr... | 3 |
@Override
public void handleNAckMessages(NackBox nackBox) {
while (nackBox.hasNext()) {
Message m = nackBox.next();
if (m instanceof PackEvent) {
PackEvent msg = (PackEvent) m;
System.out
.println("-------------NACK arrive------------------");
System.out.println("Conteúdo: " + msg.toString())... | 2 |
public static void main(String[] args) throws Exception {
String inFile = args[0]; // input .properties file
String outFile = args[1]; // output .properties file
Map props = FileUtil.loadProperties(inFile);
TestConfig test = new TestConfig(props);
test.doTest();
FileUtil.saveProp... | 0 |
private List<List<String>> filter(List<String[]> lines) throws FileNotFoundException, IOException {
Supplier<List<String>> stoplistSupplier = getStoplistSupplier();
Set<String> stopList = new HashSet<>(stoplistSupplier.get());
POSTagger posTagger = getPosTagger();
Lemmatizer lemmatizer = getLemmatizer();
Pre... | 9 |
@Override
public boolean decideDraw(int turn) {
double drawVote = 0;
for (int i=0; i < cylons.size(); i++){
if (cylons.get(i).fromDiscardForReal(game, rack))
drawVote += weights.get(i);
else
drawVote -= weights.get(i);
}
return drawVote > 0;
} | 2 |
public void filledEllipse(double x, double y, double semiMajorAxis, double semiMinorAxis) {
if (semiMajorAxis < 0) throw new RuntimeException("ellipse semimajor axis can't be negative");
if (semiMinorAxis < 0) throw new RuntimeException("ellipse semiminor axis can't be negative");
double xs = sc... | 4 |
protected boolean verifySignature(Object sig) throws IllegalStateException {
if (publicKey == null) {
throw new IllegalStateException();
}
// byte[] S = decodeSignature(sig);
byte[] S = (byte[]) sig;
// 1. If the length of the signature S is not k octets, output 'signature
//... | 8 |
public String toString(InternalPortalUrl portalUrl) {
final String serverName = ((PortalUrlImpl)portalUrl).getServerName();
final Matcher serverNameMatcher = this.serverNamePattern.matcher(serverName);
if (!serverNameMatcher.matches()) {
throw new IllegalArgumentException("C... | 9 |
public static int getRandomFleeceColor(Random var0) {
int var1 = var0.nextInt(100);
return var1 < 5?15:(var1 < 10?7:(var1 < 15?8:(var1 < 18?12:(var0.nextInt(500) == 0?6:0))));
} | 5 |
private static void simplexe() throws MatrixException {
//Exercice préparation exam
double dataA1[][] = {{1, 0, 0, 2, 3}, {0, 2, 0, 4, 0}, {2, 1, 2, 0, 2}};
double datab1[][] = {{6}, {8}, {18}};
double dataX1[][] = {{6, 4, 1, 0, 0}};
double contraintes1[][] = {{3, 1, 4, ... | 4 |
public void addPeers(Object peers) throws UnknownHostException {
if (peers instanceof List) {
List peersList = (List) peers;
for (Object elem : peersList) {
Map peerMap = (Map) elem;
ByteBuffer addressByteBuffer = (ByteBuffer) peerMap.get(ByteBuffer.wrap(... | 7 |
public int numberOfLiveNeighboursFor(Cell cell) {
List<Cell> neighbours = new ArrayList<Cell>();
for(int offsetY = -1; offsetY <= 1; offsetY++)
for(int offsetX = -1; offsetX <= 1; offsetX++)
if(!(offsetX == 0 && offsetY == 0))
if(isValidPosition((cell.y +... | 6 |
int determineFileType(String filename) {
String ext = filename.substring(filename.lastIndexOf('.') + 1);
if (ext.equalsIgnoreCase("bmp")) {
return showBMPDialog();
}
if (ext.equalsIgnoreCase("gif"))
return SWT.IMAGE_GIF;
if (ext.equalsIgnoreCase("ico"))
return SWT.IMAGE_ICO;
if (ext.equalsIgnoreCas... | 9 |
private void set(final int local, final Object type) {
maxLocals = Math.max(maxLocals, local);
while (local >= locals.size()) {
locals.add(Opcodes.TOP);
}
locals.set(local, type);
} | 1 |
public Object[] getAllElements()
{
final int cs = currSize;
Object[] retArray = new Object[cs];
if(cs < bufSize)
{
for(int i = 0; i < cs; i++)
retArray[i] = bufferArray[i];
}
else
{
int j = 0;
for(int i = rwPointer; i < bufSize; i++)
retArray[j++] = bufferArray[i];
for(int i = 0; i <... | 4 |
public ArrayList<KeyHolder> makeNextSetOfKeys()
{
ArrayList<KeyHolder> keys = new ArrayList<KeyHolder>();
for(int ii =0; ii< 26; ii++)
for(int jj =0; jj<26; jj++)
{
if(ii!=jj && (!this.areBothDuds(ii, jj)))
{
String newKey = this.key;
char temp = newKey.charAt(jj);
if(jj!=25)
new... | 7 |
public String nextToken() throws JSONException {
char c;
char q;
StringBuffer sb = new StringBuffer();
do {
c = next();
} while (Character.isWhitespace(c));
if (c == '"' || c == '\'') {
q = c;
for (;;) {
c = next();
if (c < ' ') {
throw syntaxError("Unterminated string.");
}
if... | 9 |
public void printSummary(final PrintWriter out) {
out.println("Instantiated classes:");
final Iterator instantiated = this.liveClasses.iterator();
while (instantiated.hasNext()) {
final Type type = (Type) instantiated.next();
out.println(" " + type.toString());
}
out.println("\nBlocked methods:");
i... | 5 |
private int check_number_2(int n) {
if (user_.theNumberIs(n)) {
return n;
}
if ((n + 1) % sqrt_max_ == 0) {
return -1;
}
return check_number_2(n + 1);
} | 2 |
public void run(){
//open server socket
ServerSocket serv = null;
try {
serv = new ServerSocket(serverPort);
} catch (IOException ex) {
Logger.getLogger(Server.class.getName()).log(Level.SEVERE, null, ex);
}
while(serverAlive){
//liste... | 5 |
public static void main(String[] args) {
String[] strings = {"started", "starting", "ended", "ending"};
for (String string : strings) {
if (string.startsWith("st")) {
System.out.printf("\"%s\" starts with \"st\"\n", string);
}
}
System.out.prin... | 6 |
public BeanIndexer<K> addUnsortedIndex(String property) {
Map<Object, Set<K>> holder = index.get(property);
if (holder != null && !(holder instanceof NavigableMap<?, ?>)) {
return this;
}
if (holder != null) {
removeIndex(property);
}
holder = new HashMap<Object, Set<K>>();
index.put(property, holder);... | 5 |
public ArrayList<Double> simulaPerRunReplicati() {
/* Simula fino al numero di job richiesti. */
while (this.getTempiUscita().size() < this.getJobTotali()) {
Event next = this.getCalendar().get_next();
this.setClock(this.getCalendar().get_next_time(next));
switch (ne... | 4 |
@Override
public int hashCode() {
return (int) this.user.getId();
} | 0 |
protected final void addTriggerListener( Class<? extends TriggerListener> triggerListenerType )
{
doBind( triggerListeners, triggerListenerType );
} | 1 |
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.