git-svn-id: http://svn.sourceforge.jp/svnroot/lipsync@14 b1f601f4-4f45-0410-8980-aecacb008692

This commit is contained in:
kbinani
2009-09-07 10:44:18 +00:00
parent c143ea3286
commit c089432c27
59 changed files with 3083 additions and 1854 deletions

View File

@@ -0,0 +1,25 @@
/*
* Collections.cs
* Copyright (c) 2009 kbinani
*
* This file is part of Boare.Cadencii.
*
* Boare.Cadencii is free software; you can redistribute it and/or
* modify it under the terms of the GPLv3 License.
*
* Boare.Cadencii is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
*/
//#define VECTOR_TEST
namespace bocoree {
public static class Collections {
public static void sort<T>( Vector<T> list ) {
#if !VECTOR_TEST
list.Sort();
#endif
}
}
}

64
trunk/bocoree/Graphics.cs Normal file
View File

@@ -0,0 +1,64 @@
/*
* Graphics.cs
* Copyright (c) 2009 kbinani
*
* This file is part of Boare.Cadencii.
*
* Boare.Cadencii is free software; you can redistribute it and/or
* modify it under the terms of the GPLv3 License.
*
* Boare.Cadencii is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
*/
using System;
using System.Drawing;
namespace bocoree {
public class Graphics2D {
private System.Drawing.Graphics m_graphics;
private Color m_color = Color.Black;
private Pen m_pen = Pens.Black;
private SolidBrush m_brush = new SolidBrush( Color.Black );
public Graphics2D( System.Drawing.Graphics g ) {
m_graphics = g;
}
public void clearRect( int x, int y, int width, int height ) {
m_graphics.FillRectangle( System.Drawing.Brushes.White, x, y, width, height );
}
public void drawLine( int x1, int y1, int x2, int y2 ) {
m_graphics.DrawLine( m_pen, x1, y1, x2, y2 );
}
public void drawRect( int x, int y, int width, int height ) {
m_graphics.DrawRectangle( m_pen, x, y, width, height );
}
public void fillRect( int x, int y, int width, int height ) {
m_graphics.FillRectangle( m_brush, x, y, width, height );
}
public void drawOval( int x, int y, int width, int height ) {
m_graphics.DrawEllipse( m_pen, x, y, width, height );
}
public void fillOval( int x, int y, int width, int height ) {
m_graphics.FillRectangle( m_brush, x, y, width, height );
}
public void setColor( System.Drawing.Color c ) {
m_color = c;
m_pen.Color = c;
m_brush.Color = c;
}
public Color getColor() {
return m_color;
}
}
}

22
trunk/bocoree/Iterator.cs Normal file
View File

@@ -0,0 +1,22 @@
/*
* Iterator.cs
* Copyright (c) 2009 kbinani
*
* This file is part of Boare.Cadencii.
*
* Boare.Cadencii is free software; you can redistribute it and/or
* modify it under the terms of the GPLv3 License.
*
* Boare.Cadencii is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
*/
namespace bocoree {
public interface Iterator {
bool hasNext();
object next();
void remove();
}
}

View File

@@ -0,0 +1,58 @@
/*
* ListIterator.cs
* Copyright (c) 2009 kbinani
*
* This file is part of Boare.Cadencii.
*
* Boare.Cadencii is free software; you can redistribute it and/or
* modify it under the terms of the GPLv3 License.
*
* Boare.Cadencii is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
*/
using System;
using System.Collections.Generic;
namespace bocoree {
public class ListIterator<T> : Iterator {
private List<T> m_list;
private int m_pos;
public ListIterator( Vector<T> list ) {
m_list = new List<T>();
int c = list.size();
for( int i = 0; i < c; i++ ){
m_list.Add( list.get( i ) );
}
m_pos = -1;
}
public ListIterator( List<T> list ) {
m_list = list;
m_pos = -1;
}
public Boolean hasNext() {
if ( m_list != null && 0 <= m_pos + 1 && m_pos + 1 < m_list.Count ) {
return true;
} else {
return false;
}
}
public Object next() {
if ( m_list == null ) {
return null;
}
m_pos++;
return m_list[m_pos];
}
public void remove() {
m_list.RemoveAt( m_pos );
}
}
}

106
trunk/bocoree/TreeMap.cs Normal file
View File

@@ -0,0 +1,106 @@
/*
* TreeMap.cs
* Copyright (c) 2009 kbinani
*
* This file is part of Boare.Cadencii.
*
* Boare.Cadencii is free software; you can redistribute it and/or
* modify it under the terms of the GPLv3 License.
*
* Boare.Cadencii is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
*/
//#define DICTIONARY_TEST
using System;
using System.Collections.Generic;
using System.Runtime.Serialization;
namespace bocoree {
[Serializable]
#if DICTIONARY_TEST
public class TreeMap<K, V> {
public V remove( Object key ) {
return default( V );
}
public Vector<K> keySet() {
return null;
}
public V get( K key ) {
return default( V );
}
public V put( K key, V value ) {
return default( V );
}
public bool containsKey( Object key ) {
return false;
}
public void clear() {
}
public int size() {
return 0;
}
}
#else
public class TreeMap<K, V> : Dictionary<K, V> {
public TreeMap()
: base() {
}
protected TreeMap( SerializationInfo info, StreamingContext context )
: base( info, context ) {
}
public V remove( Object key ) {
K k = (K)key;
if ( base.ContainsKey( k ) ) {
V old = base[k];
base.Remove( k );
return old;
} else {
base.Remove( k );
return default( V );
}
}
public Vector<K> keySet() {
return new Vector<K>( base.Keys );
}
public V get( K key ){
return base[key];
}
public int size(){
return base.Count;
}
public bool containsKey( Object key ) {
return base.ContainsKey( (K)key );
}
public void clear() {
base.Clear();
}
public V put( K key, V value ) {
if ( base.ContainsKey( key ) ){
V old = base[key];
base[key] = value;
return old;
} else {
base.Add( key, value );
return default( V );
}
}
}
#endif
}

174
trunk/bocoree/Vector.cs Normal file
View File

@@ -0,0 +1,174 @@
/*
* Vector.cs
* Copyright (c) 2009 kbinani
*
* This file is part of Boare.Cadencii.
*
* Boare.Cadencii is free software; you can redistribute it and/or
* modify it under the terms of the GPLv3 License.
*
* Boare.Cadencii is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
*/
//#define VECTOR_TEST
using System;
using System.Collections.Generic;
using System.Runtime.Serialization;
namespace bocoree {
[Serializable]
#if VECTOR_TEST
public class Vector<T> {
public Vector( int capacity ) {
}
public Vector( Vector<T> array ) {
}
public Vector( T[] array ){
}
public Vector(){
}
public void addAll( T[] array ) {
}
public void addAll( Vector<T> array ) {
}
public void insertElementAt( T obj, int index ) {
}
public void removeElementAt( int index ) {
}
public int size() {
return 0;
}
public T get( int index ) {
return default( T );
}
public void set( int index, T value ) {
}
public Object[] toArray() {
return null;
}
public T[] toArray( T[] array ) {
return null;
}
public Iterator iterator() {
return null;
}
public void add( T obj ) {
}
public void Add( T obj ) {
}
public bool contains( T obj ) {
return false;
}
public void clear() {
}
}
#else
public class Vector<T> : List<T> {
public Vector( ICollection<T> list ) :
base( list ) {
}
public Vector( int capacity )
: base( capacity ) {
}
public Vector( Vector<T> array )
: base( array.toArray( new T[]{} ) ){
}
public void addAll( T[] array ) {
base.AddRange( array );
}
public void addAll( Vector<T> array ) {
base.AddRange( array );
}
public void insertElementAt( T obj, int index ){
base.Insert( index, obj );
}
public bool removeElement( T obj ) {
return base.Remove( obj );
}
public void removeElementAt( int index ){
base.RemoveAt( index );
}
public Vector( T[] array )
: base( array ) {
}
public Vector()
: base() {
}
public void clear(){
base.Clear();
}
public bool contains( T obj ){
return base.Contains( obj );
}
public void add( T obj ) {
base.Add( obj );
}
public int size() {
return base.Count;
}
public T get( int index ) {
return base[index];
}
public void set( int index, T value ) {
base[index] = value;
}
public Object[] toArray() {
int c = size();
Object[] ret = new Object[c];
for( int i = 0; i < c; i++ ){
ret[i] = base[i];
}
return ret;
}
public T[] toArray( T[] array ) {
int c = size();
T[] ret = new T[c];
for( int i = 0; i < c; i++ ){
ret[i] = base[i];
}
return ret;
}
public Iterator iterator() {
return new ListIterator<T>( this );
}
}
#endif
}

View File

@@ -3,7 +3,7 @@
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProductVersion>9.0.30729</ProductVersion>
<ProductVersion>9.0.21022</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{C8AAE632-9C6C-4372-8175-811528A66742}</ProjectGuid>
<OutputType>Library</OutputType>
@@ -56,12 +56,18 @@
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="Collections.cs" />
<Compile Include="cp932.cs" />
<Compile Include="cp932reader.cs" />
<Compile Include="cp932writer.cs" />
<Compile Include="fft.cs" />
<Compile Include="Graphics.cs" />
<Compile Include="Iterator.cs" />
<Compile Include="ListIterator.cs" />
<Compile Include="math.cs" />
<Compile Include="misc.cs" />
<Compile Include="TreeMap.cs" />
<Compile Include="Vector.cs" />
<Compile Include="winmm.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="windows.cs" />

View File

@@ -19,6 +19,86 @@ using System.Collections.Generic;
namespace bocoree {
public class _FOO_BAR_STRING {
public static bool operator !=( _FOO_BAR_STRING a, _FOO_BAR_STRING b ) {
return false;
}
public static bool operator ==( _FOO_BAR_STRING a, _FOO_BAR_STRING b ) {
return true;
}
public int Length {
get {
return 0;
}
}
public _FOO_BAR_STRING[] Split( params char[] separator ) {
return null;
}
public _FOO_BAR_STRING[] Split( char[] separator, int count ) {
return null;
}
public _FOO_BAR_STRING[] Split( char[] separator, StringSplitOptions options ) {
return null;
}
public _FOO_BAR_STRING[] Split( _FOO_BAR_STRING[] separator, StringSplitOptions options ) {
return null;
}
public _FOO_BAR_STRING[] Split( char[] separator, int count, StringSplitOptions options ) {
return null;
}
public _FOO_BAR_STRING[] Split( _FOO_BAR_STRING[] separator, int count, StringSplitOptions options ) {
return null;
}
public _FOO_BAR_STRING Substring( int startIndex ) {
return null;
}
public _FOO_BAR_STRING Substring( int startIndex, int length ) {
return null;
}
public char[] ToCharArray() {
return null;
}
public char[] ToCharArray( int startIndex, int length ) {
return null;
}
public _FOO_BAR_STRING ToLower() {
return null;
}
public _FOO_BAR_STRING ToLowerInvariant() {
return null;
}
public override string ToString() {
return "";
}
public _FOO_BAR_STRING ToUpper() {
return null;
}
public _FOO_BAR_STRING ToUpperInvariant() {
return null;
}
public _FOO_BAR_STRING Trim() {
return null;
}
}
public static class misc {
/// <summary>
/// Reflectionを利用して、インスタンスのディープなクローニングを行います。