method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
ec008228-7897-4436-9fe4-e3792729699b | 3 | public void actionPerformed(ActionEvent e) {
if (automaton.getInitialState() == null) {
JOptionPane.showMessageDialog((Component) e.getSource(),
"Simulation requires an automaton\n"
+ "with an initial state!", "No Initial State",
JOptionPane.ERROR_MESSAGE);
return;
}
Object input = initialI... |
e6338a69-597d-4deb-a533-ed115184f60e | 5 | public void paint(GC gc, int width, int height) {
if (!example.checkAdvancedGraphics()) return;
Device device = gc.getDevice();
// set line attributes
gc.setLineWidth(20);
gc.setLineCap(SWT.CAP_ROUND); // round line ends
gc.setAntialias(SWT.ON); // smooth jagged edges
Pattern pattern = null;
if (foreground.... |
e2445313-de91-433e-becd-4cd1a43c8f96 | 2 | public OperationProgressDialog(String title, String message, TestStatus event) {
super();
this.title = title;
this.message = message;
this.event = event;
JProgressBar jProgressBar = new JProgressBar();
jProgressBar.setIndeterminate(true);
final JOptionPane progres... |
17070814-d58a-44ba-8c22-3601e91d59a7 | 1 | private synchronized void start(){
if(running){
return;
}
running = true;
thread = new Thread(this);
thread.start();
} |
e4c37850-ce72-43b2-a1aa-1eee109f59f6 | 0 | public GridProcessingManager(int threadsCount) {
this.threadsCount = threadsCount;
threads = new GridWorker[threadsCount];
threadStates = new boolean[threadsCount];
} |
1012429b-893d-48ae-ab76-d0e1f41a6f56 | 7 | public void onClick(int x, int y, int button){
for (int i=0;i<bHandler.length;i++){
Button b = bHandler[i];
if (b != null && x > b.getEntity().getHitBox()[0] && y > b.getEntity().getHitBox()[1] && x < b.getEntity().getHitBox()[2] && y < b.getEntity().getHitBox()[3] && button == 1){
... |
823a2a93-df74-4250-9490-f69406cb6bea | 6 | private void makeAliasList() {
if (entries.isEmpty())
return;
StringBuffer buf = new StringBuffer();
for (Iterator it = entries.iterator(); it.hasNext(); ) {
Entry entry = (Entry) it.next();
if (entry instanceof EnvelopeEntry) {
buf.append(((EnvelopeEntry) entry)... |
e6b37a27-3469-49a3-ab75-50fc468f92d2 | 4 | public void addStudent(Student student) throws IllegalArgumentException {
// Student names must be unique. This is because of a bug in JComboBox where
// getSelectedIndex() returns the first index that contains the name of
// the selected item: http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4133743
... |
2a299d33-27ef-4419-9a17-ecbd7b5a157d | 3 | public void updateJComboBoxCouleur(){
this.jComboBoxCouleurs.removeAllItems();
List<Couleur> couleurs = new ArrayList<Couleur>();
try
{
couleurs = RequetesCouleur.selectCouleur(jTextFieldCouleurLibelle.getText());
}
catch (SQLException ex)
{
... |
8bcca6df-a7ca-4e4a-880c-9f04c477f7c9 | 4 | public void seek1StepToOtherAdjacentLocation(Point centerLocation) {
if (!Physics.arePointsAdjacent(centerLocation, getLocation())) {
new IllegalArgumentException(
"currently not adjacent to centerLocation!").printStackTrace();
return; //TODO
//BUG Why does this happen sometimes?
}
Point[] adjace... |
6912dc36-bb6a-43b8-89a7-0c48c52cf345 | 8 | public static <T> Object newPrimitiveArray(Class<T> type) {
if (type.equals(byte.class)) {
return newRandomByteArray();
} else if (type.equals(int.class)) {
return newRandomIntArray();
} else if (type.equals(double.class)) {
return newRandomDoubleArray();
} else if (type.equals(char.c... |
f2007580-4acc-4c1b-bd05-316cc3debcc1 | 0 | public WanFilter(final ConnectionProcessor proc, final Properties props) {
super(proc, props);
requireConfigKey(medianLatencyKey);
medianLatency = Long.parseLong(props.getProperty(medianLatencyKey));
} |
606a544c-41d1-4b20-81db-c164311fddd1 | 8 | @Override
int transition(int absState, int position, int vector) {
// null absState should never be passed in
assert absState != -1;
// decode absState -> state, offset
int state = absState/(w+1);
int offset = absState%(w+1);
assert offset >= 0;
if (position == w) {
if (sta... |
4f48132c-3516-4380-bbf1-13d156e3b537 | 3 | private characters.Character findClosestFood(Object[] objects) {
DistList.clear();
for (int i = 0; i < World.getCharArray().length; i++) {
// System.out.println(i);
// System.out.println(World.getCharArray(i));
for (int xer = 0; xer <= MAX_DISTANCE; xer++) {
if (Utils.getDistance(World.getCharArray(i)... |
672d75bf-db2a-4473-9d05-722e65c17055 | 5 | static void skipComment(IXMLReader reader)
throws IOException,
XMLParseException
{
if (reader.read() != '-') {
XMLUtil.errorExpectedInput(reader.getSystemID(),
reader.getLineNr(),
"<!--");
}
i... |
a29c6583-6bcc-403b-954f-584c7e235746 | 8 | String classToType(Class cls) {
if (cls==Point.class) {
return "int2";
} else if (cls==Integer.TYPE
|| cls==Integer.class ) {
return "int";
} else if (cls==Double.TYPE
|| cls==Double.class ) {
return "double";
} else if (cls==String.class) {
return "String";
} else if (cls==Boo... |
0d455ef6-04d1-4cdd-ac74-b9748746ea93 | 5 | private void processCatalogueDeleteMasterResult(Sim_event ev)
{
if (ev == null) {
return;
}
Object[] pack = (Object[]) ev.get_data();
if (pack == null) {
return;
}
String filename = (String) pack[0]; // get file name
int msg =... |
23ad0c8e-46cc-4508-b07a-34ace61c806e | 2 | public void play() {
Scanner scanner = new Scanner(System.in);
System.out.println("************ Welcome to < B O W L I N G _ G A M E > ************");
System.out.print("Input Player Number : ");
int playerCount = scanner.nextInt();
createPlayer(playerCount);
for ( int frameNum = 0; frameNum < 10; f... |
89883c26-40f7-444b-b454-b4bf33131ca2 | 4 | public void removeFirst()
{
int position = 1;
if ( this.isEmpty() || position > numItems || position < 1 )
{
System.out.print("This delete can not be performed "+ "an element at position " + position + " does not exist " );
}
for (int i=position-1; i< numItems-1; i++)
this.bookArray[i] = this.bookArra... |
8bb76190-a2df-471e-a394-415882fb5bbd | 8 | public static ArrayList<String> FetchjobsFromJobPortal(String urlForJob)
{
WebDriver driver1 = new FirefoxDriver();
// Code for pagination
driver1.get(urlForJob);
ArrayList<String> listOfJobs = new ArrayList<String>();
//WebElement ulOfPagination = divForJobs.findElement(By... |
1ad7f330-6462-4be3-a959-dc418e200548 | 8 | @Test
public void testMarker() {
source.markColor("this", ColorConstants.WHITE);
source.markColor("is", ColorConstants.BLACK);
source.markColor("simple", ColorConstants.YELLOW);
source.markColor("text", ColorConstants.YELLOW);
List<Word> words = source.getKnownWords(ColorConstants.YELLOW);
assertEquals(2... |
f1452ce5-1cb7-4333-8022-15986fed7fec | 0 | public int getTreatmentSize(){
return treatment.size();
} |
43297d10-b5ad-436b-9051-d95fa3bc0f44 | 2 | public int firstIndexOf(Attributes attributeList) {
for (int i = 0; i < size; i++) {
if (attributeLists[i] == attributeList) {
return i;
}
}
return -1;
} |
75749142-ffc5-4fa7-9d89-adcdf977d300 | 7 | public void updateTimer()
{
long l = Minecraft.func_71386_F();
long l1 = l - lastSyncSysClock;
long l2 = System.nanoTime() / 0xf4240L;
double d = (double)l2 / 1000D;
if (l1 > 1000L || l1 < 0L)
{
lastHRTime = d;
}
else
{
... |
5aaa4632-59b7-4b14-b04b-2821487d8b8d | 3 | public String validateConnection(Object source, Object target)
{
if (target == null && createTarget)
{
return null;
}
if (!isValidTarget(target))
{
return "";
}
return graphComponent.getGraph().getEdgeValidationError(
connectPreview.getPreviewState().getCell(), source, target);
} |
4c59ef24-c5b0-4abe-a59b-e408626d711e | 6 | public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("{\n");
for(Variable i : vals) {
sb.append(i.getName());
sb.append(" : ");
if(i.getType().isPrimitive()) {
sb.append(i.getType());
} else if(i.getType().isArray()) {
sb.append(i.getType());
} else if(i.getType(... |
6dd0d2df-b476-4f70-9a69-fb01596ff873 | 2 | private void printDebug() {
System.out.println("============");
System.out.println("flame-cycle:" + flameCycle);
if (onDemandFetcher != null) {
System.out.println("Od-cycle:" + onDemandFetcher.onDemandCycle);
}
System.out.println("loop-cycle:" + Client.loopCycle);
... |
84430b8a-2077-4837-a5a8-0b1aa4aefc3f | 1 | @Transactional
public Step createStep(Integer taskId, String stepName) {
Task task = tasksDao.getById(taskId);
if (task == null) {
throw new RuntimeException("No such task");
}
Step step = new Step();
step.setTask(task);
step.setName(stepName);
st... |
d2e5e751-961f-443b-82be-a090e1750bee | 5 | @Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
TracksInPlaylists that = (TracksInPlaylists) o;
if (playlistId != that.playlistId) return false;
if (trackId != that.trackId) return false;
... |
343bc235-d4ec-4351-8b1c-99e3ad2f3608 | 5 | private void printAcross( ArrayList<Pair> pairs, Node u, BitSet incoming )
throws MVDException
{
int hint = -1;
Arc selected = u.pickOutgoingArc( incoming );
if ( selected != null )
{
if ( selected.to.isPrintedIncoming( selected.versions) )
System.out.println("incoming arc alre... |
e887239d-b364-4d6e-be1b-daba3c9c4407 | 2 | @SuppressWarnings("rawtypes")
public SecurityCommand(Map o) {
this.area = ((Long) o.get("area") != null) ? ((Long) o.get("area")).intValue() : MessageConstants.DEFAULT_AREA;
this.mode = (SecurityModeEnum) o.get("mode");
this.code = ((Long) o.get("code") != null) ? ((Long) o.get("code")).intValue() : Mes... |
45f36b54-f1ca-467f-93b4-9df68fd7eff3 | 3 | private static int binarySearch(int[] sorted, int key, int imin, int imax, int buffer) {
int imid = 0;
while (imax >= imin) {
imid = (imin + imax) / 2;
if (sorted[imid] < key) {
imin = imid + 1;
} else if (sorted[imid] > key) {
imax = imid - 1;
} else {
return sorted[imid];
}
}
return... |
4e93c603-19a3-4c93-bf05-cf21d540c364 | 9 | private static void generateJavaFile(File genFolder, String packageName, String destClassName, String content) {
File folder = new File(genFolder, packageName.replaceAll("\\.", "/"));
if (!folder.exists()) {
folder.mkdirs();
}
File javaFile = new File(folder, destClassName + ".java");
if (javaFile.ex... |
3233c216-525e-40ab-b688-38a5ebda6dc9 | 7 | public boolean confirm(Runnable runnable) {
boolean ret = false;
// if the model has changed since the last save
if(theModel.isDifferentFromFile()) {
// loop while the user's decision hasn't been made.
// this is here in case the user selects an erroneous
// choice. in that case, it will loop bac... |
05f5c0cf-301a-48b6-aaf9-8284ce08f386 | 2 | public Object[] getValues()
{
for (int i = 0; i < editors.length; i++)
if (editors[i] != null)
values[i] = editors[i].getValue();
return values;
} |
8ca81e33-3447-4228-b237-72c7e894a8a9 | 5 | private void sink(int i)
{
int t = pq[i]; // save for later restoring at correct position
while (2 * i + 1 <= N) // The node has both the children
{
int j = 2 * i + 1; // right child
if (greater(items[pq[j]], items[pq[j - 1]])) // determine the
// lesser child
j--;
if (greater(item... |
60e2f73a-7ee6-4ba6-87a1-a7ba273172b7 | 3 | private Expr factor() {
if (theTokenizer.ttype == '(') {
theTokenizer.next();
Expr exp = expr();
theTokenizer.accept(')');
return exp;
} else if (theTokenizer.ttype == Tokenizer.TT_NUMBER) {
int x = (int) theTokenizer.nval;
theTokenizer.next();
return new Num(x);
} else if (theTokenizer... |
29f6e066-a321-468d-8d62-9af6f950f6fe | 8 | static String exec( List<String> cmd,
File binDir,
File workDir,
boolean parseOutput,
boolean tossErrorOutput )
throws IOException, InterruptedException
{
String[] cmdp = cmd.toArray( ... |
04eb668d-7105-4023-9bcb-b5a21b09b87c | 3 | private void moviesInvolvedTableMousePressed(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_moviesInvolvedTableMousePressed
if(moviesInvolvedTable.rowAtPoint(evt.getPoint()) == -1){
moviesInvolvedModel.fireTableDataChanged();
//purkkaviritys, koska moviesInvolvedTable.clearSelection(... |
aa90dd3c-b485-488d-af7f-343b34b47479 | 9 | public ModelCanvas get(Object key) {
if (!lazyInit)
return map.get(key);
ModelCanvas value = map.get(key);
if (value == null) {
if (key.equals(MOLECULAR_MODEL_1)) {
initAtomContainer(0);
value = new ModelCanvas(atomContainer[0]);
map.put(MOLECULAR_MODEL_1, value);
}
else if (key.equals(MOL... |
3d701ee5-bd64-4ea6-8b5f-0a06733dbea4 | 3 | @Override
public boolean equals(Object obj){
if (obj == null) return false;
if (this == obj) return true;
if (getClass() != obj.getClass()) return false;
Person q = (Person)obj;
return name.equals(q.name);
} |
1dfd593f-b0df-4589-84b7-b135eccac616 | 0 | @SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
jPanel1 = new javax.swing.JPanel();
jLabelTitre = new javax.swing.JLabel();
jSeparator1 = new javax.swing.JSeparator();
jLabel... |
657b9a54-ae61-4dd0-913e-478a687093d7 | 4 | public static boolean supportsBatchUpdates(Connection con) {
try {
DatabaseMetaData metaData = con.getMetaData();
if (metaData != null) {
if (metaData.supportsBatchUpdates()) {
LOGGER.debug("JDBC驱动支持批量更新");
return true;
} else {
LOGGER.debug("JDBC驱动不支持批量更新");
}
}
} catch (SQLExce... |
38a5d34e-de02-4096-83dc-99df2d3fa8ef | 4 | @Override
@Deprecated
public String removeProtection(String EntityI, Vector<String> properties)
{
Vector<Vector<String>> triples= new Vector<Vector<String>>();
String xml="";
boolean ack=false;
//String Protection_Entity = "http://" + Double.toString(Math.random());
String Protection_Entity = "http://" ... |
75b1606b-2f2b-47a1-8691-a44e6cf1242d | 4 | public boolean peutSupprimer(Utilisateur utilisateur) {
return
utilisateur != null
&& (
utilisateur.equals(getCreateur()) ||
utilisateur.getRole().getValeur() >= Role.Moderateur.getValeur()
)
&& (
getCategorie().getJ... |
eaa8b081-44ef-4335-bb1e-7d980188a5c7 | 0 | @Override
public void rotate(int angle)
{
super.rotate(angle,center);
setColoredExes();
} |
c8ae2c08-c613-4dcb-b3e7-a0a60e161d0a | 2 | private void mapEmbeddedInInstance(ResultSet resultSet,ClassInspect parentInspector, E instance) throws ResultMapException {
List<Field> annotatedFields = parentInspector.findAllAnnotatedFields(Embedded.class);
ClassInspect embeddedClassInspector = null;
for(Field field : annotatedFields) {
logger.debug("Mappi... |
0bdb5a64-1ebb-4c04-be55-af79d245c464 | 5 | public Handshake(String s) throws MalformedHeaderException {
//System.out.println(s);
String[] headers_received = s.split("\n");
for (String header : headers_received) {
Header h = null;
try {
h = new Header(header);
} catch (SpecialHeaderException ex) {
Class search = ex.getCorrectType();
... |
44a7ec9c-b0e5-4d5c-a723-a1082ae14dc3 | 6 | private static void quit() {
// the stats of the game
System.out.println("Your statistics are:- ");
System.out.println("moves: " + moves);
System.out.println("money: " + playerBank);
System.out.println("score: " + points);
System.out.println("strength " + damage);
System.out.println("health: " + playerH... |
4bff3a14-5224-428e-9cf1-1861791aec3d | 4 | public void inject() throws ClassNotFoundException, NoSuchFieldException, IllegalAccessException, NoSuchMethodException, CannotCompileException, InstantiationException, NotFoundException, InvocationTargetException {
Field configManagerField = Class.forName("net.minecraft.server.MinecraftServer").getDeclaredFiel... |
66588bc1-c41c-4762-a21c-178687c161ba | 6 | private boolean readZipFile(String fileName)
{
boolean success = false;
ZipFile zipFile = null;
try
{
BufferedReader reader = null;
// ZipFile offers an Enumeration of all the files in the Zip file
zipFile = new ZipFile(fileName);
Enum... |
fbae1734-1805-4810-b09e-86d8dc38f3ae | 6 | public AngriffOptions(JSONObject options) {
if (options.has("Zwerg")) {
try {
if (options.getBoolean("Zwerg")) {
buyCrystal = 0;
}
} catch (JSONException r) {
try {
buyCrystal = options.getInt("Zwerg");
} catch (JSONException p) {
}
}
}
if (options.has("Medizin")) {
try... |
d4c71668-1b58-4a36-9f3f-65767b4a5051 | 8 | private void updateWeights(double[] labels) {
NeuralNode[] outputNodes = _layers[_layers.length - 1].getNodes();
NeuralNode[] prevNodes = _layers[_layers.length - 2].getNodes();
for(int i = 0 ; i < prevNodes.length; i++){
for(int j = 0 ; j < outputNodes.length ; j++){
double deltaWeight;
if ((int) l... |
ec01b64f-c299-44a1-bfe8-f8f65d3fbd32 | 2 | private String valorMonetario(Double valor) throws ValidacaoException {
String dinheiro = Validadores.isValorMonetario(valor);
if (dinheiro.isEmpty() || dinheiro.equals("0")) {
throw new ValidacaoException("O Campo " + validacao.Descricao() + " não é valor Monetário válido!");
} els... |
9e14a029-d75a-44ed-89ec-db7a8c6b98ff | 0 | @Override
public void loadRcon() throws DataLoadFailedException {
ConfigurationSection sec = getData("server", "rcon");
YamlPermissionRcon permBase = new YamlPermissionRcon(sec);
load(PermissionType.RCON, permBase);
} |
62269b98-f65a-489d-bb03-788c09b10216 | 1 | public void tallennaTiedostoon(){
String palautettava = "";
for (String avain: opiskelut.keySet()) {
palautettava += avain + " " + opiskelut.get(avain) + " ";
}
kasittelija.tallennaTiedostoon(palautettava);
} |
d36bad63-10d8-41a4-b1be-5b546d220967 | 0 | public void setData(byte[] data) {
this.data = data;
} |
bea03caa-3540-47b1-a557-0c552d4c342d | 1 | public GenericBuilderSupport() {
if (log.isLoggable(Level.CONFIG)) {
log.config("oms.version : " + System.getProperty("oms.version"));
log.config("oms.home : " + System.getProperty("oms.home"));
log.config("oms.prj : " + System.getProperty("oms.prj"));
}
} |
bb5fd13b-fe99-4de6-861f-bb25707b9d25 | 6 | public int Problem87() {
int[] primos = Utility.listarPrimalidade((int) Math.sqrt(LIMITE87));
Set<Integer> sums = new HashSet<Integer>();
sums.add(0);
for (int i=2;i<=4;i++) {
Set<Integer> newSums = new HashSet<Integer>();
for (int p : primos) {
long q = 1;
for (int j=0;j<i;j++) {
q *= p;
... |
84b0262d-fe07-4c95-b614-fb931128b1de | 3 | private static void accessServer() {
Socket link = null;
try {
link = new Socket(host, PORT);
Scanner input = new Scanner(link.getInputStream());
PrintWriter output = new PrintWriter(link.getOutputStream(), true);
// set up stream for keyboard entry..
Scanner userEntry = new Scanner(System.in);
S... |
cf713b7b-f64f-4f02-8d04-9cef1301f953 | 9 | public static void main(String path) throws IOException
{
File f=new File(path);
BufferedImage cat = ImageIO.read(f);
f.delete();
path=path.replace(".jpg_binary.png","");
path=path.replace(".JPG_binary.png","");
// Loop through all the pixels in th... |
94c3e68a-9e0f-494a-954f-1b7d9418d5b2 | 4 | private int getHitRegion(RPChromosomeRegion hitRegion, boolean contained) {
int hitCount = 0;
// check if new hit list is needed
// Note: getHitList will reset mLeafItemIndex to 0, the beginning of new hit list
if (leafHitList == null) { //|| mLeafItemIndex >= mLeafHitList.size()){
... |
3177eb02-9dba-43a7-a54b-5d6937b07ef9 | 4 | private static void validateLocalePart(String localePart) {
for (int i = 0; i < localePart.length(); i++) {
char ch = localePart.charAt(i);
if (ch != '_' && ch != ' ' && !Character.isLetterOrDigit(ch)) {
throw new IllegalArgumentException(
"Locale part \"" + localeP... |
05beefd8-7ad1-4d41-80b0-4ec2804fc9bf | 4 | public static String convertFilenameToJSPName( String name )
{
StringBuffer buf = new StringBuffer();
char[] chars = name.toCharArray();
for( int i = 0; i < chars.length; i++ )
{
if( chars[i] == '_' )
{
chars[i + 1] = Character.toUpperCase( chars[i + 1] );
}
else if( chars[i] == '-' )
{
... |
cd59d478-83ee-4431-9b2d-5949fbff9bba | 7 | public Individual[] selectIndividuals(Individual[] population) {
//make a new array to store the fit individuals
Individual[] fitIndividuals = new Individual[population.length];
//first, calculate the sum of e^(the fitness)
double fitnessSum = 0.0;
for(Individual i : population) {
fitnessSum += i.getExpFi... |
d5776176-57f7-4efb-b2d0-b780e0de4e49 | 2 | public static Dictionary createNew(Connection con, String name, String desc, String lang1, String lang2)
{
Dictionary dict = null;
try
{
PreparedStatement ps = con.prepareStatement(
"INSERT INTO " + tableInfo.tableName
+ " (Name, Descr, Lang1, Lang2) VALUES (?, ?, ?, ?)",
Statement.RETURN_GENER... |
013b5b65-a638-4994-8b5a-a557044d5971 | 3 | public void tick() {
if (x != targetX || y != targetY) {
double pathX = (targetX - x);
double pathY = (targetY - y);
double distance = Math.sqrt(pathX * pathX + pathY * pathY);
xVel = (float) (pathX / distance) * 2;
yVel = (float) (pathY / distance) * 2;
x += xVel;
y += yVel;
}
if(t.Ring(... |
a59b4673-142a-480b-b09e-5f321ddc33c9 | 4 | protected void formOrderList(SessionRequestContent request) throws ServletLogicException {
Criteria criteria = new Criteria();
User user = (User) request.getSessionAttribute(JSP_USER);
if (user != null) {
criteria.addParam(DAO_USER_LOGIN, user.getLogin());
ClientType type... |
63fb98a5-c3b6-4be1-a421-28f69ec2b2eb | 6 | final void method3805(int i, Interface11 interface11) {
try {
anInt7697++;
if (anInt7738 < 0
|| interface11 != anInterface11Array7741[anInt7738])
throw new RuntimeException();
anInterface11Array7741[anInt7738--] = null;
interface11.method45((byte) -47);
if (i == 8387) {
if (anInt7738 < 0... |
7c102e7e-f822-4f2a-beb3-efaecc1eada5 | 3 | private void initLightPoint()
{
String str[] = DataCount.firstAccept(user_name);
String label0 = "你的排名为【" + str[0] + "】" + ",已完成【" + str[1] + "】道题";
String label1 = "你有【" + str[2] + "】道题第一次提交就获得Accept";
int num = 0;
String label2 = "你在 ";
Iterator<String> itertime = timemap.keySet().iterator();
while(ite... |
15f2dca0-af91-4314-849d-444f3a070d74 | 9 | public Network(int inputNeurons, int hiddenLayers, int hiddenNeurons, int outputNeurons, boolean biased) {
if (inputNeurons < 1 || outputNeurons < 1 || hiddenLayers < 0) {
throw new IllegalArgumentException();
}
if (hiddenLayers > 0 && hiddenNeurons < 1) {
throw new IllegalArgumentException();
}
i... |
41630a10-3068-4331-9b6b-8305ba30dafd | 7 | @Override
public void actionPerformed(ActionEvent e) {
//System.out.println("DefaultAction");
OutlinerCellRendererImpl textArea = null;
boolean isIconFocused = true;
Component c = (Component) e.getSource();
if (c instanceof OutlineButton) {
textArea = ((OutlineButton) c).renderer;
} else if (c in... |
6fa87432-3f24-4585-8a61-13a17edf539c | 4 | public IClusterCalculable[][] getResult() {
//根据Tmatrix来输出结果
HashMap<Integer, ArrayList<IClusterCalculable>> clusterMap = new HashMap<Integer, ArrayList<IClusterCalculable>>();
for (int i = 0; i < dNum; i++) {
IClusterCalculable data = oriDatas[i];
data.setTypeID(Tmatrix[... |
47efdfab-048e-4408-b90a-a9ae10cd14d5 | 2 | public PolyBlockType getBlockType() {
int type = iterator.getBlockType();
for (PolyBlockType pbt: PolyBlockType.values()) {
if (type == pbt.value) {
return pbt;
}
}
LOGGER.warn("Unrecognized PolyBlockType: " + type);
return PolyBlo... |
5be961c3-fa67-41e9-98ba-cefe32ecce11 | 4 | private Enum<?> getOperator(Token token) {
for (Enum<?> oper : opers) {
if (token.equals(oper.toString()))
return oper;
}
return null;
} |
6a84e0ad-ae66-45c6-93e3-3c3082e56a4b | 9 | public synchronized boolean cacheClean()
{
long l = System.currentTimeMillis();
Enumeration localEnumeration = this.images.elements();
while (localEnumeration.hasMoreElements())
{
ImageTrack localImageTrack = (ImageTrack)localEnumeration.nextElement();
int i = checkImage(localImageTrack.... |
597637d1-b5ac-4a26-b63b-e88e50d6730b | 9 | public void makeMagic() {
prevKey = keyStates;
keyStates = getKeyStates();
moveSuccess = false;
if (prevKey == keyStates) return;
if ((keyStates & LEFT_PRESSED) != 0) {
move(MV_LEFT);
} else if ((keyStates & RIGHT_PRESSED) != 0) {
move(MV_RIGHT);
... |
4b54fb6c-cb36-4ff4-8195-8c730651c121 | 0 | public void setHasVisited(boolean hasVisited) {
this.hasVisited = hasVisited;
} |
2964567e-0e37-4b61-9241-72bbff707980 | 6 | @EventHandler
public void EnderDragonHeal(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.getEnderDragonConfig().getDouble("EnderDr... |
8543748f-4427-48ae-bb48-5561d327c2b1 | 6 | private void addPage(Element parent) {
Element pageNode = doc.createElementNS(getNamespace(), DefaultXmlNames.ELEMENT_Page);
parent.appendChild(pageNode);
//Image filename
addAttribute(pageNode, DefaultXmlNames.ATTR_imageFilename, page.getImageFilename());
//Width/height
addAttribute(pageNode, Default... |
8d850134-42de-4eb0-af49-e2e159b5aa3e | 1 | public static Map<String,Integer> readTickers() throws IOException {
final BufferedReader reader = new BufferedReader(new FileReader("stocks.txt"));
final Map<String,Integer> stocks = new HashMap<String, Integer>();
String stockInfo = null;
while ((stockInfo = reader.readLine()) != null){
final S... |
c4ee61ab-675e-482b-89ee-5184876c60a6 | 0 | private Queries()
{
} |
831dbe6a-2f52-4e13-8ace-b93266830b60 | 1 | @Override
public void union(int p, int q)
{
int pRoot = find(p); // component of p
int qRoot = find(q); // component of q
// Do nothing if p and q belong to the same component
if (pRoot == qRoot)
return;
// Label the component-id of pRoot as qRoot, thus effectively making the
// component-id of all v... |
c2de98a8-dfc6-4bd6-8d0a-e07ac2b39244 | 3 | @Override
protected String crearTextoRespuesta() {
StringBuilder sb = new StringBuilder("***Resultados del algoritmo de deducción***\n\n");
sb = sb.append("Explicación:\n");
for (Regla r : reglasDisparadas) {
sb = sb.append("Se disparó la regla ").append(r.getIndiceDeRegla()).ap... |
046e3e94-21f8-4a42-8957-5ebb8040786c | 8 | public Packet packet() throws IOException {
if (eos)
return (null);
if (strm == null) {
strm = new StreamState();
page = in.page();
strm.init(page.serialno());
}
Packet pkt = new Packet();
while (true) {
int ret = strm.p... |
a782316c-93c8-4692-be31-9d6818c91ebb | 7 | @Override
public boolean equals(Object other) {
if (!(other instanceof NBTBase)) {
return false;
} else {
NBTBase tempOther = (NBTBase) other;
return this.getId() == tempOther.getId() && ((this.name != null || tempOther.name == null)
&& (this.n... |
f746131c-018a-4450-8176-b8808f4501eb | 3 | public boolean addSong(MusicObject music) throws SQLException {
if (connection == null) {
connection = getConnection();
}
if (addSongStmt == null) {
addSongStmt = connection.prepareStatement("INSERT INTO org.MUSIC" +
"(song_name," +
"file_name," +
"folder_path," +
"folde... |
449a33e7-8d6b-4d2b-a175-2d09b2d16fc8 | 5 | private static void appendJSONPair(StringBuilder json, String key, String value) throws UnsupportedEncodingException {
boolean isValueNumeric = false;
try {
if (value.equals("0") || !value.endsWith("0")) {
Double.parseDouble(value);
isValueNumeric = true;
... |
cd1c63d8-38c1-4d07-8e25-24c7c20cade5 | 8 | private Set<String> parseOutcome(PreferenceMetaData pmd, BufferedReader reader, String line) throws IOException {
Set<String> outcome = new HashSet<String>();// First state/outcome in the trace
do {
for (String var : pmd.getVariables()) {
if (line.indexOf("\\" + var + " = ") != -1) {
line = line.tri... |
a8aa6bc9-0f41-4704-bb9e-f5feaed5bab8 | 1 | public ClassInfo getClazz() {
return clazz != null ? clazz : ClassInfo.javaLangObject;
} |
08823c8c-1b4d-4414-819f-97ae06510155 | 1 | public final String getPackageName() {
String qname = qualifiedName;
int index = qname.lastIndexOf('.');
if (index < 0)
return null;
else
return qname.substring(0, index);
} |
00f71626-b30b-4a92-a791-d8d26f951d61 | 8 | protected boolean isPlaceHolder( String to_check ){
return ( to_check.equals("Add1") || to_check.equals("Add2") ||
to_check.equals("Mul1") || to_check.equals("Mul1") ||
to_check.equals("Div1") || to_check.equals("Div2") ||
to_check.equals("Load1")|| to... |
4ad2f070-404a-41cc-8d75-3bc1ec1b19cf | 0 | Animal(String name, float weight, String speech, FlyingAbility flyingAbility) {
this.name = name;
this.weight = weight;
this.speech = speech;
this.flyingAbility = flyingAbility;
} |
70759d0d-119b-402c-bd2a-e52a64a0e916 | 6 | 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... |
5918c462-ed15-4233-9418-4040c87b6987 | 9 | private void _outOtherStatements() {
pw.println("\n" +
" ////////////////////\n" +
" // other statements");
_outEdgeOtherRelationStyle();
for ( Statement stmt : _info.getStatements() ) {
// TODO for now, ignoring statements about ontology resource
if ( _info.containsOntology(stmt.getSubje... |
dbd95258-0295-4c0b-9666-f8fcb9d2b949 | 9 | protected void loadFields(com.sforce.ws.parser.XmlInputStream __in,
com.sforce.ws.bind.TypeMapper __typeMapper) throws java.io.IOException, com.sforce.ws.ConnectionException {
super.loadFields(__in, __typeMapper);
__in.peekTag();
if (__typeMapper.isElement(__in, Case__typeInfo)) {
... |
18769a9b-ca24-4443-8154-d16ff7eaecec | 7 | public VTKPanel(SimulatorWindow rootFrame) {
fcInput = new JFileChooser();
fcInput.setFileFilter(new FileNameExtensionFilter("XML-Dateien", "xml"));
fcOutput = new JFileChooser();
final VTKPanel contentPane = this;
final SimulatorWindow window = rootFrame;
setLayout(new GridBagLayout());
GridBagCons... |
f8323318-3352-4cb5-a42f-de830f63ed30 | 8 | void transParseInterp(String langlocale, String format, String interrupts, ArrayList<SS_log> log, ArrayList<SS_playlist> pl, ArrayList<SS_arglist> argsx, String transcount)
{
read.lock();
try
{
SS_translation trans = find_translation(langlocale, format);
if (trans != null)
{
... |
6c7a52c2-ed7d-4f00-9c38-69ba1e027e18 | 4 | public void init(int mode, byte[] key, byte[] iv) throws Exception{
String pad="NoPadding";
byte[] tmp;
if(iv.length>ivsize){
tmp=new byte[ivsize];
System.arraycopy(iv, 0, tmp, 0, tmp.length);
iv=tmp;
}
if(key.length>bsize){
tmp=new byte[bsize];
System.arraycopy(k... |
792b9a6d-a93e-4c53-8754-dfea84f5ca81 | 4 | private void updateBestScores()
{
if((bestScores != null) && (bestScores.size() > 0))
{
bestScores.add(this);
Collections.sort(bestScores);
Collections.reverse(bestScores);
for(int i=0; i<bestScores.size(); i++)
{
if (i >= 5)
{
bestScores.remove(i);
}
}
}
else
{
best... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.